I'm working on a plugin to insert some custom html wherever the cursor is positioned. The problem is that the html that im trying to insert is a div and occasionally the cursor is placed within a p tag. HTML specifications state that you cannot have a div within a paragraph, so ckeditor is removing my div tag.
My html to insert:
<div class="module module-placeholder" data-module-type="projectListing">This area will be replaced with project listing tabs when saved.</div>
Converts to:
This area will be replaced with project listing tabs when saved.
Of course if the cursor is within a div instead of a paragraph, it works fine. Is there any good way to check to see if we're currently within a paragraph and escape it if so?