如何在 CKEditor 3.6.4 中关闭自动格式化代码?
How to turn off auto-formating code in CKEditor 3.6.4?
也许是在 CKEditor 3.6.4 版中关闭自动格式化 HTML 代码的方法?
我只找到了how to disable auto </br> after <td> in CKEditor?,但我需要关闭这个功能。
现在我尝试保存代码:
{if key is 1}<li>custom text</li>{/if}
我得到:
<li>
{if key is 1}</li>
<li>
custom text</li>
<li>
{/if}</li>
CKEditor 仅适用于有效的 HTML,<li>
标签之外的文本无效。引用 CKEditor basic concepts:
CKEditor is not a tool that will let you input invalid HTML code. CKEditor abides by W3C standards so it will modify code if it is invalid.
但是您可以尝试使用 config.protectedSource
来隐藏这些模板的标记,但是您需要创建一个好的正则表达式来仅隐藏真正的标签而不是 {
和 [=14 之间的任何文本=].可以工作的最简单的实现是:
config.protectedSource = [
/{\/?[\w]+(?: [\w\s]+)?}/g
];
但真正的 on 将取决于这些标签中真正可能使用的内容。
也许是在 CKEditor 3.6.4 版中关闭自动格式化 HTML 代码的方法?
我只找到了how to disable auto </br> after <td> in CKEditor?,但我需要关闭这个功能。
现在我尝试保存代码:
{if key is 1}<li>custom text</li>{/if}
我得到:
<li>
{if key is 1}</li>
<li>
custom text</li>
<li>
{/if}</li>
CKEditor 仅适用于有效的 HTML,<li>
标签之外的文本无效。引用 CKEditor basic concepts:
CKEditor is not a tool that will let you input invalid HTML code. CKEditor abides by W3C standards so it will modify code if it is invalid.
但是您可以尝试使用 config.protectedSource
来隐藏这些模板的标记,但是您需要创建一个好的正则表达式来仅隐藏真正的标签而不是 {
和 [=14 之间的任何文本=].可以工作的最简单的实现是:
config.protectedSource = [
/{\/?[\w]+(?: [\w\s]+)?}/g
];
但真正的 on 将取决于这些标签中真正可能使用的内容。