Open Bug 1425661 Opened 6 years ago Updated 2 years ago

Copy pasting from OpenOffice/LibreOffice to Thunderbird overrides unchecked option "Use Paragraph format instead of Body Text by default"

Categories

(Core :: DOM: Editor, defect, P3)

52 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: tbreportbug, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.0; rv:52.0) Gecko/20100101 Firefox/52.0
Build ID: 20171206101620

Steps to reproduce:

How to reproduce:
1. Write text in OpenOffice or Libreoffice with default formatting (line spacing is 1). Select this text and press CTRL+C.
2. Open Thunderbird and go to Preferences -> Composition. From here uncheck the box "Use Paragraph format instead of Body Text by default. Press close.
3. Open Thunderbird and press the Write button to open a new window to write an email.
4. Paste the text you copied from OpenOffice/Libreoffice to this "Write window" of Thunderbird.


Actual results:

The formatting of the pasted text is now ruined, because it is paragraph formatted (it should not be). Also if I select all of the text, and change from "Paragraph" to "Body Text", it does not change the formatting the way it should be. 


Expected results:

By pasting text from OpenOffice/LibreOffice to Thunderbird, the formatting should stay the same, just like it was in the original OpenOffice/LibreOffice file. (And not change into paragraph formatting.)
Pasting paragraphs from LibreOffice gives:
    <p style="margin-bottom: 0cm; line-height: 100%">jk</p>
    <p style="margin-bottom: 0cm; line-height: 100%">jk</p>
    <p style="margin-bottom: 0cm; line-height: 100%">jk</p>
This can also be seen in FF alone at https://www-archive.mozilla.org/editor/midasdemo/

Richard, what styles are at play here so there is space between the lines? Still a margin-top? Must be, since when I edit this to margin:0, the space goes away.

Changing this to body text gives:
    jk<br>
    <br>
    jk<br>
    <br>
    jk<br>
so there are a few undesired empty lines, although the match the "look" of the paragraphs. Note that converting "normal" paragraphs without style attribute doesn't insert unwanted breaks.

I'd split this into two bugs since we're looking at two issues here, both in Core::Editor.
Component: Message Compose Window → Editor
Flags: needinfo?(richard.marti)
Product: Thunderbird → Core
Thinking about this a little more: The first problem is really a problem in LibreOffice. The HTML that it places into the clipboard is incomplete, so therefore the text looks different in the Mozilla editor than in the LibreOffice document. You should file a bug there. Pasting content from MS Word usually works well, since Word places a complete style sheet onto the clipboard.

You could use "Paste Without Formatting".
From toolkit html.css a margin-block-start: 1em; is applied as default for <p>. You'd need also a margin-top: 0 to remove all space above the <p>.

The difference of margin-block-end to margin-inline-end or here margin-bottom is, that it begins at the start (here on top) of the block. When we have a 16px font and line-height: 100%; then the first 16px do nothing and then it begins to augment the margin. margin-block-start begins at the same position like the margin-block-end which is doing here the spacing.
Flags: needinfo?(richard.marti)
There seems to be a similar problem in Word:

How does one maintain the format when copy and pasting from WORD to Thunderbird?
https://support.mozilla.org/fi/questions/1173599

I have answered to that topic and explained why this is such a big issue, and why "Paste Without Formatting" is an unacceptable solution for this issue:

"Seriously this issue is huge. Let's say I have a text (written in OpenOffice/LibreOffice) that is 3000 words long and includes: 30 links, texts that are bolded, unordered lists etc.

And I wish to send this text to 20 different people. And I want to change the introduction of the text slightly for all these different people. I just cannot "Paste Without Formatting", because it requires tremendous work to get that formatting then correct."
I have reported the issue also in LibreOffice and OpenOffice BugZillas, in case the problem is partly due to their software.

https://bugs.documentfoundation.org/show_bug.cgi?id=114501
https://bz.apache.org/ooo/show_bug.cgi?id=127633
Priority: -- → P3

https://bugs.documentfoundation.org/show_bug.cgi?id=114501
https://bz.apache.org/ooo/show_bug.cgi?id=127633

I posted this kind of update on the LibreOffice and OpenOffice BugZillas:

The issue might be partly on LibreOffice's/OpenOffice's end. If we have this kind of text:

/START
Text here

Text here

Text here

Text here

Text here

Text here

Text
Text
Text
Text
End.
/END

And then we try to export this message as HTML from LibreOffice, then we get something like this:

<p style="margin-bottom: 0cm; line-height: 100%">Text here</p>
<p style="margin-bottom: 0cm; line-height: 100%"><br/>

</p>
<p style="margin-bottom: 0cm; line-height: 100%">Text here</p>
<p style="margin-bottom: 0cm; line-height: 100%"><br/>

</p>
<p style="margin-bottom: 0cm; line-height: 100%">Text here</p>
<p style="margin-bottom: 0cm; line-height: 100%"><br/>

</p>
<p style="margin-bottom: 0cm; line-height: 100%">Text here</p>
<p style="margin-bottom: 0cm; line-height: 100%"><br/>

</p>
<p style="margin-bottom: 0cm; line-height: 100%">Text here</p>
<p style="margin-bottom: 0cm; line-height: 100%"><br/>

</p>
<p style="margin-bottom: 0cm; line-height: 100%">Text here</p>
<p style="margin-bottom: 0cm; line-height: 100%"><br/>

</p>
<p style="margin-bottom: 0cm; line-height: 100%">Text</p>
<p style="margin-bottom: 0cm; line-height: 100%">Text</p>
<p style="margin-bottom: 0cm; line-height: 100%">Text</p>
<p style="margin-bottom: 0cm; line-height: 100%">Text</p>
<p style="margin-bottom: 0cm; line-height: 100%">End.</p>

But this is what SHOULD be exported from LibreOffice I think, so that everything would work okay:

<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm">Text here</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm"><br/>

</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm">Text here</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm"><br/>

</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm">Text here</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm"><br/>

</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm">Text here</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm"><br/>

</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm">Text here</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm"><br/>

</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm">Text here</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm"><br/>

</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm">Text</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm">Text</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm">Text</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm">Text</p>
<p style="margin-bottom: 0cm; line-height: 100%; margin-top: 0cm">End.</p>

To reiterate, the problem with the current system seems to be:

  1. Paragraphs have default margin-top value. The margin-top value should be 0cm!

Is there something that can be done on Thunderbird's side? Is there at least some work around, until this gets fixed?

Nothing can be done on Thunderbird's side since we're using the standard Mozilla core editor.

We see many problems with HTML originating from *Office packages, MS Office being the worst offender.

The conclusion is that those office packages just don't produce decent HTML that could be processed in a HTML editor, which is what the TB compose window is. All I can suggest is to install https://addons.thunderbird.net/en-GB/thunderbird/addon/thunderhtmledit/ and fix the HTML manually.

Also, a paragraph is what it is, a paragraph, not a line of text. So having paragraphs with zero margins/padding is a big no-no that will surely cause problems later. It's just that users of office packages still in the year 2019 have a typewriter mentality of the year, well, 1910 (and before, see https://en.wikipedia.org/wiki/Typewriter) where hitting the enter key advances to the next line. Office packages still cater to that taste by default, and there was a big outcry when Thunderbird adopted the paragraph format by default which does have some margin/padding.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.