Problem/Motivation

When we have a paragraph type which label contains a quote (or a few other special chars), its label ends up being double escaped in the buttons title. That's because Drupal.t() converts these chars to htmlentities (to mirror what's done in PHP) then Element.setAttribute() escapes that value again because it does not expect to get any HTML.

Steps to reproduce

  1. Create a paragraph type which label contains a quote
  2. Configure one content type to allow to reference this paragraph type
  3. Configure the widget to show the add in between buttons

Expected: the button's title attribute is human readable
Current: the button's title attribute contains escaped html entities

Proposed resolution

Use a DOMParser trick to convert entities back before setting the button title.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

DuaelFr created an issue. See original summary.

duaelfr’s picture

Status: Active » Needs review
duaelfr’s picture

This is also related to #3343428: Escaped quotes in add in between paragraphs labels which has the same issue on the button text.

stBorchert made their first commit to this issue’s fork.

  • stBorchert committed fb2e25b8 on 2.1.x authored by DuaelFr
    Issue #3344007 by stBorchert: In between button title is double escaped
    

  • DuaelFr authored f4bf11b5 on 2.1.x
    Issue #3344007 by DuaelFr: In between button title is double escaped
    
stborchert’s picture

Status: Needs review » Fixed

Thanks for the fix ... I accidentally used the wrong commit message so I added another commit with some more fixes and proper credits.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.