werein / x-editable-rails

Edit fields easily with X-Editable helper

Home Page:https://wereinhq.com/guides/x-editable-rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Broken attributes with HTML content

retani opened this issue · comments

A link tag created by wysihtml5 has attributes using double quotes:

<a target="_blank" rel="nofollow" href="http://www.example.com">www.example.com</a>

X-Editable will use this code directly in it's "value" attribute, causing the HTML to break (watch out for the quotes):

<span class="editable" data-model="event" data-name="description" data-placeholder="Text" data-type="wysihtml5" data-url="/events/44?locale=de" data-value="test<br>test<br><a target="_blank" rel="nofollow" href="http://www.example.com">www.example.com</a><br><br>abc<br><br>" title="Text">test<br>test<br><a target="_blank" rel="nofollow" href="http://www.example.com">www.example.com</a><br><br>abc<br><br></span>

A simple way to fix this could be base64-encoding the value attribute.

Thank you! Your pull-request has been manually merged