CKEditor带有不可编辑的岛屿 [英] CKEditor with noneditable islands
问题描述
我们如何在非readOnly区域中拥有不可编辑区域?
注意我仍然需要编辑器的大部分有可编辑的内容,因此使用readOnly模式不是一个选项。对于这些区域设置contentEditable = true不起作用,看起来CKEditor会删除其子标签的所有contetnEditbale值。
How can we have non-editable areas in a non-readOnly area? Notice I still need most of the editor have editable content, so using readOnly mode is not an option. Setting contentEditable=true for those areas doesn't work, it seems like CKEditor strips all contetnEditbale values of it's children tags.
推荐答案
CKEditor 4.3介绍了 Widget System ,它可以解决这个问题 - 它允许您在内容中包含不可编辑的片段。实际上,它允许你做更多的事情,因为这些不可编辑的岛屿可能会有可编辑的碎片,你可以限制每个嵌套的编辑可以启用什么功能等。
CKEditor 4.3 introduced Widget System which solves exactly this issue - it allows you to have non-editable fragments in the content. Actually, it allows you to do much more than that, because these non-editable islands may then have editable fragments, you can restrict per nested editable what features are enabled, etc.
开头的一些链接:
- Introduction to Widgets,
- Widgets SDK introduction,
- Creating a Simple CKEditor Widget (Part 1),
- Widget API.
还有一些实例:
- 简单框插件,
- 已应用的图片,
- 代码段具有语法高亮显示,
- 占位符。
- Simplebox plugin,
- Captioned images,
- Code snippets with syntax highlighting,
- Placeholder.
PS。我们还应该阅读高级内容过滤器。
PS. I think you should also read about the Advanced Content Filter.
这篇关于CKEditor带有不可编辑的岛屿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!