ckeditor转义所有文本 - 我怎么能防止它这样做 [英] ckeditor escapes all text - how can I prevent it from doing so

查看:427
本文介绍了ckeditor转义所有文本 - 我怎么能防止它这样做的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想让ckeditor转义文字写。我使用编辑器,客户可以编写自己的邮件模板,我给他们的代码片段,他们可以粘贴在编辑器中的文本中合并动态数据,ala $ {customer.name}。

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}.

然后,文本将保留到数据库中,并在代码中再次检索其他位置,并通过Freemarker填充数据。这里的问题 - Freemarker使用< > 字符,但是ckeditor转义它们。

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?

推荐答案

如何配置ckeditor不要这样做?

解决方案

CKeditor正在创建HTML,

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

就个人而言,我会在浏览器发送的内容之间放一个翻译器,服务器和发送到FreeMarker的内容,无论是存储模板时,还是呈现时。如果您的用户熟悉FreeMarker,请继续允许他们使用>和<,但是在尝试呈现它们之前先解除它们。

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.

这篇关于ckeditor转义所有文本 - 我怎么能防止它这样做的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆