(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?

喜夏-厌秋 提交于 2019-12-24 10:37:29

问题


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.

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)

Update:

same question - better explanation then my: http://vanillaforums.org/discussion/13627/ie-uses-paragraph-tags-firefox-uses-br-tags/p1

please help me, what should i change for create 'br' tag also in IE instead 'p' tag.

Thanks, Yosef


回答1:


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);

But content should have at least one paragraph. Only in this case firefox will generate "p".



来源:https://stackoverflow.com/questions/4725049/jquery-rich-text-editor-how-can-be-fixed-bug-in-rich-text-editor-when-press

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!