问题描述
使用内联编辑器CKEDITOR 4.2.0和Firefox 23.0.1,我的可编辑div标签的内部html富含< br type =_ moz>
。它不会插入IE。
With the inline editor CKEDITOR 4.2.0 and Firefox 23.0.1 the inner html of my editable div tags are enriched with <br type="_moz">
. It is not inserted with IE.
我可以使用javascript轻松找到并替换这个标签。
I can easily find and replace this tag using javascript.
如何我处理这个在config.js文件全局的所有我的内联可编辑的div?
How can I handle this in the config.js file globally for all my inline editable divs?
推荐答案
不应从 element.innerHTML
(或 $(element).html()
)。在CKEditor从 editor.getData()
(这是使用的正确方法)返回的内容之间有明显的区别。
You should not get data from inline editor by element.innerHTML
(or $(element).html()
). There's a significant difference between what's really in there and what will CKEditor returns from editor.getData()
(which is the correct method to use).
这种区别来自于数据(由 editor.setData()
- yup设置 - 不直接设置它)需要被转换为在 contenteditable
元素中更好的可编辑。因此,那个转换(以及/为浏览器所做的其他奇怪的事情)需要被还原,这发生在 editor.getData()
。
This difference comes from the fact that data (set by editor.setData()
- yup - don't set it directly too) needs to be transformed to be better editable inside contenteditable
element. Therefore, then that transformation (and other weird things done by/for browsers) need to be reverted and this happens on editor.getData()
.
PS。如果你不知道在哪里得到编辑器实例,请检查全局 CKEDITOR.instances
对象。
PS. If you don't know where to get editor instances check global CKEDITOR.instances
object.
这篇关于想要移除< br type =" _moz">标签在CKEDITOR 4.2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!