HTML Editor: copy-pasting text does not handle tags well



Message Compose Window
5 years ago
5 years ago


(Reporter: Joris Debonnet, Unassigned)


21 Branch
Windows 7

Firefox Tracking Flags

(Not tracked)




5 years ago
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0
Build ID: 20130409194949

Steps to reproduce:

- Start a new html email
- Select all and then press delete, to remove any default formatting
- Write "This a is test."
- Select all and make it Arial, then press the "smaller font" button. At this point the source is: 
<small><font face="Arial">This a is test. <br>
- Double click the word "is" (which will also select the space on its right), cut (control-x), and paste it in front of "a" in order to correct the sentence. 

Actual results:

The word "is" is in a smaller font than the rest of the line, due to the tag <small> having been repeated during the paste:
<small><font face="Arial">This </font></small><small><font face="Arial"><small><font
        face="Arial">is </font></small>a test. <br>

Expected results:

The pasted word should have the same size as the rest of the line. Better yet, none of those excessive tags should have been added. 

The best way to achieve this is probably to stop putting outer tags into the clipboard, or stripping them off when pasting. That would probably save a lot of trouble elsewhere. 
But if we need to keep the excessive tags, then the problem is simply that some things are placed in the wrong order:

It did this:

And it's probably supposed to do this:

Comment 1

5 years ago
I suppose changing the font to Arial is an unnecessary step, sorry about that. Using the <small> or <big> button suffices to reproduce the bug in any recent version of Thunderbird. 

It is also reproducible in, but it does not have a visual effect there since it uses absolute font sizes. You'll see in the source though that the starting tag for the "end" part is put in the wrong place: in front of rather than after the "paste" part.
You need to log in before you can comment on or make changes to this bug.