(富jQuery文本编辑器)如何修复富文本编辑器中的错误-在Firefox创建的"br"标签中按Enter键,而在IE创建的"p"标签中按Enter键? [英] (Jquery-Rich Text Editor) How can be fixed bug in rich text editor - when press enter in firefox created 'br' tag but in IE created 'p' tag?
问题描述
我在使用 cleditor (富JavaScript文本编辑器)的网站上工作. 编辑器存在错误-在firefox中创建的"br"标签但在IE中创建的"p"标签的字母后按Enter键.
I working on website that use cleditor (Jquery-Rich Text Editor). The editor have bug - when press enter after letter in firefox created 'br' tag but in IE created 'p' tag.
错误复制: 您可以在他们的演示 http://premiumsoftware.net/cleditor/中看到这一点(输入一些输入,最后按Enter (Firefox + IE)-看到行与行之间的间距不同,因为在IE中生成的是'p'标签,而在Firefox中是生成为'br'标签的Firefox)
Bug reproduction: You can see this in their demo http://premiumsoftware.net/cleditor/ (enter some input end press enter (Firefox + IE ) - see different space between lines because in IE generated 'p' tag vs firefox that genarated 'br' tag)
更新:
same question - better explanation then my: http://vanillaforums.org/discussion/13627/ie-uses-paragraph-tags-firefox-uses-br-tags/p1
请帮助我,我也应该在IE中代替"p"标签来创建"br"标签.
please help me, what should i change for create 'br' tag also in IE instead 'p' tag.
谢谢, 约瑟夫
推荐答案
这不是错误. CLEditor使用标准的浏览器api可以在不同的浏览器中产生不同的结果,并且您无法更改IE行为,但是可以使用execCommand在Mozilla中禁用"br"生成
It is not a bug. CLEditor uses standart browser api which can produce different result in different browsers and you cannot change IE behaviour but you can disable "br" generation in Mozilla by using execCommand
$("#input").cleditor()[0].doc.execCommand("insertBrOnReturn", false, false);
但内容应至少包含一个段落.只有在这种情况下,firefox才会生成"p".
But content should have at least one paragraph. Only in this case firefox will generate "p".
这篇关于(富jQuery文本编辑器)如何修复富文本编辑器中的错误-在Firefox创建的"br"标签中按Enter键,而在IE创建的"p"标签中按Enter键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!