[USER=11388]@Chris D[/USER] part of the problem is the single line copy & paste fragment is haven't the wrapping <p>
tags stripped so normalizeBrForEditor
isn't doing anything. The editor then behaves differently for inline copy & paste vs block copy & paste.
The other part is paste.afterCleanup
event is only working on the content being inserted and not the full editor. So the inline copy & paste can put the editor into a bad state.
Block copied text is;
[code=html]word1 word2<br>
word1 word2[/code]
Editor before;
[code=html]<p><br></p>[/code]
Editor after;
[code=html]<p>word1 word2</p><p>word1 word2</p>[/code]
Inline copied text is;
[code=html]word1 word2[/code]
Editor before;
[code=html]<p><br></p>[/code]
Editor after;
[code=html]<p>word1 word2<br></p>[/code]
Calling XF.EditorHelpers.normalizeBrForEditor(ed.$el)
in the the paste.after
event should fix this.
I think leaving the call to normalizeBrForEditor
inside normalizePaste
will work, as this code should be very lightweight compared to what is already been done.