https://bugs.documentfoundation.org/show_bug.cgi?id=167894

            Bug ID: 167894
           Summary: Italics (but not bold) disappearing when copying text
                    that was previously pasted from HTML source
           Product: LibreOffice
           Version: 25.2.5.2 release
          Hardware: x86 (IA32)
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Writer
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 202274
  --> https://bugs.documentfoundation.org/attachment.cgi?id=202274&action=edit
Html file containing source data for copy/paste

A certain, very simple fragment of HTML is pasted into Writer, containing both
italics and bold formatting. The formatting appears correct after pasting.
However, copying the text FROM Writer and pasting it elsewhere (even into
another section of the same document) results in SOME of the italics
disappearing, even while other parts of the copied text retain their
formatting.

The exact HTML sequence that I use to reproduce this issue is:
```
<p><em>Italics. <strong>Bold and italics.</strong> Italics again.</em></p>
```

To reproduce the bug, an EXACT HTML snippet needs to be copied to the
clipboard. The HTML cannot be copied from a web page manually through a
browser, as the browser adds on additional "style" information which changes
the behavior of the Writer application.

You can use any of several tools to inspect the contents of your clipboard and
see what is actually being copied. I use:
https://evercoder.github.io/clipboard-inspector/

To make this easy to reproduce, I've attached an HTML file with some javascript
that copies the above HTML exactly.

STEPS TO REPRODUCE
1. Download the attached .html file.
2. Edit the html file in a text editor to examine the simple javascript code
contained therein. (Because don't just run random code you find online without
looking at it!)
3. Open the html file in your web browser of choice.
4. Click the "Copy" button on the page. (Do not highlight and copy the text
manually.)
5. Observe and acknowledge the success message.
6. Open a new instance of Writer.
7. Press Ctrl+V to paste the copied text into the empty document. Observe that
the middle section of the text is both in italics and in bold.
8. Highlight the text in Writer which you just pasted.
9. Press Ctrl+C to copy the text.
10. Set the cursor elsewhere in the document (such as the empty line below).
11. Press Ctrl+V to paste.
12. Observe that, in this newly pasted text, the middle section is bold but not
italicized.

Using the above clipboard-inspector tool, you can see exactly what Writer
incorrectly copied to the clipboard in step 9. It copies this:
```
<p><em>Italics.
</em><strong>Bold and italics.</strong><em> Italics again.</em></p>
```

This can result in loss of formatting information when copying text to other
applications, or between sections of the document. It is 'dangerous' in the
respect that the text SEEMS fine until you try and copy it somewhere else. In
testing, I've found that this text remains 'dangerous' even after the document
is saved (as an .odt), closed, and reopened.

It may be relevant to note that, if the original copy source uses <b> tags
instead of <strong>, this issue does not occur.

ENVIRONMENT INFO:
Installer:
LibreOffice_25.2.5_Win_x86-64.msi
Downloaded from:
https://www.libreoffice.org/download/download-libreoffice/
Windows 11 Pro 24H2 26100.4652 64-bit

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to