I am making a custom plugin for the rich texteditor which sets a span with a certain class to a selected text, like:
<span class="myclass">text</span>
Ok, so pretend I have the following text:
This is a test.
Now after selecting test and clicking the button to trigger my plugin it will output:
This is a <span class="myclass">test</span>.
Now after this I select the whole text and click the button again, this will output:
<span class="myclass">This is a <span class="myclass">test</span>.</span>
Any idea how to fix this?