We are using Tinymce 5.6.2 in our project and facing really weird issue. We have two custom buttons and when you click on them they add some HTML (for example span tags). So to reproduce the issue, first click on Button1 this will insert below HTML into editor window:
<p><span class="container1"><span class="icon1">1</span>[[Test One]]</span></p>
Now click on Button2 and that will insert another HTML. Technically it should insert new HTML before Button1 content because we have shifted our cursor to beginning of editor window and before Button1 content but when you see code of editor window, you find second set of HTML elements got inserted into Button1’s HTML. See below image:
I’ve created a fiddle to reproduce this issue: https://fiddle.tiny.cloud/f5haab/3
Anyone has any idea why it’s happening and how to resolve this issue?