Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upEscape Editable HTML #17994
Escape Editable HTML #17994
Conversation
This comment has been minimized.
This comment has been minimized.
Tested this with the following post in That's actually wrong because I typed "…HTML is Before saving and reloading this was in the text view of the editor.
And this displayed in the page view: On this branch however…
and after save and reload Regardless of the details this seems to address the issue and get us out of a painful place where you can't type what you want. Thanks @ellatrix! |
This is a good fix and covers at least one common case that's frustrating. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@davilera Have you tested this PR? It should fix that too. |
This comment has been minimized.
This comment has been minimized.
I tested #13218, and this PR fixes it too. Added a test case. |
This comment has been minimized.
This comment has been minimized.
Just for extra clarity: this fixes all escaping for all HTML entities in editable text, not just |
This comment has been minimized.
This comment has been minimized.
Thanks for the review @dmsnell! |
ellatrix commentedOct 17, 2019
•
edited
Description
Fixes #16252.
Fixes #13218.
Alternative to #17789.
General problem: currently we only escape "lone" ampersands (
&
=>&
) in editable text. This is a bit strange, since if you create some text, you'd expect e.g.&
to be rendered as such. This is NOT the case.&
needs to be converted to&
in order to be rendered as&
. The same is true for any other HTML entity.Also removes a unnecessary layer of escaping and unescaping from the code block. The attribute source is of the type
text
, which already unescapes entities. In the code block, we only need to make sure the value fromPlainText
is properly escaped for use in normal HTML elements (sincePlainText
is atextarea
and its value is unescaped.How has this been tested?
…
. Preview the post. You should see…
and not…
.…
. Save. Reload the place. The block should be valid.Screenshots
Types of changes
Checklist: