When pasting text into the editor using Firefox, it incorrectly formats the text

Some of my users identified this issue and I was able to reproduce it on my forum as well as here.

Specifically what is happening is the editor is changing the formatting of the pasted text, either by adding new lines where there were none, or removing them.

What it should look like:

“Hello. My name is David, and I’m a quinquagenerian.”

Game industry veteran David Mullich kicked off a panel discussion on game industry ageism today at the 2015 Game Developers Conference like he was introducing himself at a group therapy session.

It was a light-hearted way to address an insidious problem.

It turns out like this:

“Hello. My name is David, and I’m a quinquagenerian.”

Game industry veteran
David Mullich kicked off a panel discussion on game industry ageism
today at the 2015 Game Developers Conference like he was introducing
himself at a group therapy session.

It was a light-hearted way to address an insidious problem.

Source of above text: Latest News | Game Developer

One of my users had to paste the text into a text editor then into the edit box to get the intended formatting.

I honestly don’t know if this is a Firefox bug or a Discourse bug, but other text inputs on Firefox don’t display this issue in my testing.

If I copy and paste the properly formatted text from this post back into here, I get this:

“Hello. My name is David, and I’m a quinquagenerian.”Game
industry veteran David Mullich kicked off a panel discussion on game
industry ageism today at the 2015 Game Developers Conference like he was
introducing himself at a group therapy session. It was a light-hearted way to address an insidious problem.

This is from the first improperly formatted result from before:

“Hello. My name is David, and I’m a quinquagenerian.”Game industry veteran
David Mullich kicked off a panel discussion on game industry ageism
today at the 2015 Game Developers Conference like he was introducing
himself at a group therapy session. It was a light-hearted way to address an insidious problem.

Notice the slight difference in where it inserted the new lines?

Also noticed that sometimes when pasting in some text on Firefox, the preview doesn’t reflect the new text until I make another change.

Firefox is weird.

  • Copy from Firefox, paste in Firefox → as reported.
  • Copy from Chrome, paste in Firefox → no newlines at all.
  • Copy from Chrome, paste in Notepad, copy again and paste in Firefox → works.
  • Copy from Firefox and paste in Chrome → works too.

My guess is that both browsers put richtext into the clipboard, and Firefox has problems with pasting that into a plaintext input field. Or could it be that Discourse somehow makes FF think that the editor supports richtext?

5 Likes

Any help with this? I guess I expect at least someone from the core team to respond. If I had more time I would look into it myself, but I won’t have time for a week or more. :frowning:

Sounds like a plausible bug, we will get to it at some point but not sure if in the next couple of weeks.

2 Likes

Thanks, wasn’t expecting a fast fix.

I can still reproduce this and it bugs me because it makes longer texts unreadable (or I have to reformat pasted text). There is a reason why people use newlines and this Discourse/Firefox behaviour I experience ridicules the idea of newlines.

I’m on Firefox 47.0 and we are using Discourse v1.6.0.beta8 +25.

1 Like

Using Ctrl+v to paste produces the weird formatting as reported. Pasting with the middle button doesn’t.

Currently Firefox 47 on Ubuntu Gnome 16.04, but it’s been like this on Ubuntu for as long as I can remember.

1 Like