Grapesjs: [BUG]: HTML attributes/traits not escaped

Created on 28 Feb 2018  路  5Comments  路  Source: artf/grapesjs

When double quotes are added to an attribute it breaks the HTML.

  1. https://jsfiddle.net/szLp8h4n/
  2. Drag in the link block.
  3. Click the link in the editor
  4. Go to "Component settings" panel
  5. Enter This is an "example" into title field.
  6. Click the view code icon.
  7. Invalid HTML is generated
<div class="c318">Hello World!!!</div>
<a title="This is an  "example"" class="c739">Link</a>
help wanted outdated

All 5 comments

Thanks for the catch James
PRs are welcome

Looks like the fix only replaces the code in the Grapes editor but when getHtml() is called the issue is still present.

Inspected code:
<input type="text" name="company" placeholder="This is an &quot;example&quot;" required="false" data-highlightable="1" class="gjs-comp-selected">

Output from get editor.getHtml():
<input type="text" name="company" placeholder="This is an "example"" required="false"/>

@nojacko I don't build files before the release so if you're using files from dist you're still using the old one

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kosirm picture kosirm  路  3Comments

desilvaNSP picture desilvaNSP  路  3Comments

kawika-connell picture kawika-connell  路  3Comments

krunal039 picture krunal039  路  3Comments

kickbk picture kickbk  路  3Comments