Reply to thread

So for reasons that do not make sense to me, I have tracked it down to this line:


[CODE="javascript"]selectedHtml = ed.html.getSelected();[/CODE]


If you have this editor content:


[CODE="html"]<p>test test test</p>[/CODE]


And you select only the middle test the result of ed.html.getSelected() is:


[CODE="html"]<p>test</p>[/CODE]


The end result being what we insert into the editor is:


[CODE="html"][ICODE]<p>test</p>[/ICODE][/CODE]


Which will look like this:


[CODE][ICODE]

test

[/ICODE]

[/CODE]


The behaviour somewhat makes sense - after all, if the actual editor content looked like this:


[CODE="html"]<p><strong>test test test</strong></p>[/CODE]


You would want the selection to include <strong> because otherwise that formatting could be lost (depending on what you're doing with the selection).


We did use a different approach in 2.2.11 but that had other issues:

[URL unfurl="true"]https://xenforo.com/community/threads/editor-insertspoiler-does-not-correctly-handle-formatting.210134/[/URL]


At this point it feels tempting to just remove the outer <p></p> if we're working with an inline tag, as we are here.


I hate working with this editor.


Back
Top Bottom