Third party Copy and paste creates a new line even though no new line was copied

sbj

Well-known member
Affected version
2.2
nl1.gif
 
What's more, copying and pasting text with whitespace before it, creates additional whitespace before and after it.

I'm not sure if it's related to the new line issue above - but it's similar enough I figured I'd post it here rather than start a new bug report (please split to new bug report if it is unrelated)

My snagit video capture isn't working, so I'll try and explain in screenshots.

1. start with a single word at the start of the line with no whitespace before or after:

1593094076053.png

2. copy the text and then paste it immediately after without inserting any whitespace - you get the expected result:

1593094125797.png

3. do the same thing, single word at the start of the line, but this time, don't copy the whole word, only copy one of the letters (any amount less than the full word)

1593094712237.png
4. paste it at the end of the word without inserting whitespace and the editor will automagically insert whitespace before and after the pasted text

1593094776048.png

5. now do the same thing again with a word at the beginning of the line, but put whitespace after the text before copying only the text (but not the whitespace).

1593094366580.png

6. paste the text immediately after the text but before the whitespace - the pasted text has whitespace automagically inserted before it and after it:

You would expect "foofoo bar", but instead you get "foo foo bar" with whitespace inserted both before and after the pasted foo and so there is now two spaces between the 2nd foo and the bar:

1593094524591.png

It seems as though the editor will do the right thing if you copy an entire line up to the line ending, but anything which doesn't include a line ending, will cause the editor to insert whitespace both before and after the text.

I also note that if you paste anything that doesn't include a line ending onto a new line, it will only insert whitespace at the end of the pasted text, not at the beginning.
 
Last edited:
The whitespace issue was also reported here: https://xenforo.com/community/threads/pasting-atop-a-selected-word-inserts-1-or-2-spaces.184733/

In terms of this report, it appears to be a Firefox-specific Froala bug. It also specifically relates to doing this on the last line of content and from something you just typed (rather than pre-loaded content from editing). I've opened a report about it here:


Given the edge case-ness of this and because it's relatively easy to resolve, I'm not sure we'll see a fix for this. Indeed, there can be an argument that the behavior isn't wrong -- MS Word seems to include the line break if you highlight the whole line, for example.
 
Back
Top Bottom