Open Bug 865527 Opened 11 years ago Updated 2 years ago

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

Categories

(Thunderbird :: Message Compose Window, defect)

21 Branch
x86_64
Windows 7
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: bugzilla, Unassigned)

Details

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>
  </font></small>
- 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>
  </font></small>


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:
<tag>begin</tag><tag><tag>PASTE</tag>end</tag>

And it's probably supposed to do this:
<tag>begin</tag><tag>PASTE</tag><tag>end</tag>
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 http://www-archive.mozilla.org/editor/midasdemo/, 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.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.