CKEditor adds <p> tags after <div> created using the .insertElement editor

I am developing a plugin for CKEditor 3, and whenever I insert a div element of type, it automatically inserts tags <p> </p>after closing the tag </div>.

i.e.

<div class="a">
    ....
</div>
<p>
    &nbsp;</p>

I do not want him to add tags <p> </p>at the end. Is there a way to do this without modifying the config.js file?

Code plugin.js:

aDiv = editor.document.createElement('div');
aDiv.setAttribute('class', 'a');
aDiv.setText('...');
editor.insertElement(aDiv);
+4
source share

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


All Articles