(JQuery-Rich Text Editor) How can I fix a mistake in a text editor - when press enter in firefox created with the tag 'br', but the tag 'p' is created in IE?

I work on a website using cleditor (a jQuery-Rich text editor). The editor has an error - when hit enter after the letter in firefox, the created tag is 'br', but in IE the tag 'p' is created.

Error reproduction: You can see this in your demo http://premiumsoftware.net/cleditor/ (type some input end press enter (Firefox + IE) - see Different space between the lines, because in IE the generated tag 'p 'vs firefox, which decrypts the tag' br ')

Update:

the same question is the best explanation, then mine: http://vanillaforums.org/discussion/13627/ie-uses-paragraph-tags-firefox-uses-br-tags/p1

please help me what should I change to create the 'br' tag also in IE instead of the 'p' tag.

Thank you yosef

+1
source share
1 answer

It's not a mistake. CLEditor uses a standard api browser that can produce different results in different browsers, and you cannot change IE behavior, but you can disable the "br" generation in Mozilla using execCommand

$("#input").cleditor()[0].doc.execCommand("insertBrOnReturn", false, false);

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

-1
source

Source: https://habr.com/ru/post/1786190/


All Articles