ejs icon indicating copy to clipboard operation
ejs copied to clipboard

escape method of utils breaks rich text editing on second pass

Open boutell opened this issue 13 years ago • 2 comments

There is code in the escape method to be clever and prevent double-escaping:

.replace(/&(?!\w+;)/g, '&')

Unfortunately, if you're discussing HTML in a rich text editor, you're going to deliberately write things like:

Which need to be double-escaped when you output them again to be edited again. Otherwise the rich text editor sees them as rich markup and not as text talking about rich markup.

Double-escape prevention as a default behavior that can't be overridden is problematic.

I'm going to see what happens if I write a custom alwaysEscape filter and use <%-.

boutell avatar Jun 11 '12 23:06 boutell

Sigh, of course Markdown ate that, what I meant to show was something like this:

And here you'll want a textarea in your template!
<textarea>...</textarea>

I encountered this issue while blogging about node in a blog written in node (:

boutell avatar Jun 11 '12 23:06 boutell

@boutell I am in the same boat you where two years ago. Did you ever end up making that alwaysEscape filter and if not how did get around the problem? thanks!

bvallelunga avatar Mar 02 '14 04:03 bvallelunga