I am creating my own wysiwyg editor and I encountered an issue.
As for the editor itself, it is pretty standard, I am using contenteditable iframe with some execcommand buttons for bold text and so on.
Now for my issue, I am not sure how to keep the html structure neat and clean.
For example, user clicks a button to make text he selected floated to the right which takes the selected text and wraps it in
<div style="float: right">selected text</div>
. But if the users selects the text multiple times floating it back and forth something like this be the result.
<div style="float: right">
<div style="float: left>
<div style="float: right">
selected text
</div>
</div>
</div>
, that is of course pretty messy and ugly.
Is there some clean way how to handle this? (And I don't want to use some third party editors like MCE)
Thanks