We have built a custom plugin to add content to the editor. The JS is something like this:
myEditor.insertHtml('
<div class="wrapper thing">
<div class="other wrapper">
<img src="myfile.jpg">
</div>
</div>');
This works fine, and as expected. However, if I then hit enter in the editor and then try to add another similar image (using the same code as above), this is what I get:
<div class="wrapper thing">
<div class="other wrapper">
<img src="myfile.jpg">
</div>
<div class="other wrapper">
<div class="wrapper thing">
<div class="other wrapper">
<img src="myfile.jpg">
</div>
</div>
</div>
</div>
This is certainly bad behavior, but I'm not sure how to fix it. Any ideas?
myEditor.insertHtml('
<div class="wrapper thing">
<div class="other wrapper">
<img src="myfile.jpg">
</div>
</div>');
This works fine, and as expected. However, if I then hit enter in the editor and then try to add another similar image (using the same code as above), this is what I get:
<div class="wrapper thing">
<div class="other wrapper">
<img src="myfile.jpg">
</div>
<div class="other wrapper">
<div class="wrapper thing">
<div class="other wrapper">
<img src="myfile.jpg">
</div>
</div>
</div>
</div>
This is certainly bad behavior, but I'm not sure how to fix it. Any ideas?