gpt4 book ai didi

CKeditor protectedSource Handlebars

转载 作者:行者123 更新时间:2023-12-02 22:06:16 24 4
gpt4 key购买 nike

我尝试将 CKeditor 与 Handlebars 模板结合使用,以允许用户在我们的应用程序中自定义消息。

CKEditor 做了一些奇怪的事情

事情变成这样了:

<table>
<thead>
<tr>
<td>Activity</td>
<td>Quantity</td>
<td>Rate</td>
<td>Amount</td>
</tr>
</thead>
<tbody>
{{line_items}}
</tbody>
</table>

进入此:

{{line_items}}
<table>
<thead>
<tr>
<td>Activity</td>
<td>Quantity</td>
<td>Rate</td>
<td>Amount</td>
</tr>
</thead>
<tbody></tbody>
</table>

然后谷歌搜索让我使用 config.protectedSource 来保护所有 Handlebars 。

CKEDITOR.replace('template_body', {
//... other stuff

protectedSource: [
/{{[\s\S]*?}}/g
]
}

此设置确实可以正确保护 Handlebars 标签不被移动和删除,但又会阻止它们被查看/编辑!

CKEditor 在编辑模式下隐藏 protected 源代码,并在源代码模式下显示它!这是一个错误吗?我在编辑器的源代码模式下可以看到 {{}},但在常规模式下却看不到?

最佳答案

查看请求数,它看起来像是 this plugin 的作者做了很棒的工作,尝试一下。您将能够使用它以所见即所得模式编辑 protected 源代码。

关于CKeditor protectedSource Handlebars ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28968142/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com