ckeditor escapes all text - how can I prevent it from doing so

被刻印的时光 ゝ 提交于 2020-01-17 10:55:47

问题


I dont want the ckeditor to escape text written. I use the editor such that customers can write their their own mailtemplates, and I give them code snippets they can paste in the around in the text in the editor to merge in dynamic data, ala ${customer.name}.

The text is then persisted to database and retrieved again other places in code and filled with data through Freemarker. And here the problem amerge - Freemarker uses < and > characters, but the ckeditor escapes them. How can I configure ckeditor to not do this?

thanks in advance


回答1:


CKeditor is creating HTML, so the < and > characters are reserved, and if it wasn't escaping them, the text wouldn't display.

Personally, I would put a translator between what the browser sends to the server and what is being sent to FreeMarker, either when the template is stored, or when it's rendered. If your users are familiar with FreeMarker, continue to allow them to use > and <, but then unescape them before trying to render them.



来源:https://stackoverflow.com/questions/6949938/ckeditor-escapes-all-text-how-can-i-prevent-it-from-doing-so

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!