Closed Bug 1315480 Opened 5 years ago Closed 5 years ago

LibreOffice/MS Office integration: Convert image data referencing MIME parts via imap/mailbox URLs to data URLs (for viewed messages)

Categories

(Thunderbird :: Message Reader UI, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 52.0

People

(Reporter: jorgk-bmo, Assigned: mkmelin)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 2 obsolete files)

Since we're talking to TDF/LibreOffice as a new home for Thunderbird, let's keep everybody happy by improving the interoperability.

Currently pictures copied from TB to *Office end up as ugly placeholders, in MS Office pasting invisibly and in LibreOffice showing some funny imap/mailbox URL.

We can improve this by placing the images as data URLs onto the clipboard.
Attached patch bug1315480_copy_data_urls.patch (obsolete) — Splinter Review
Covers the copy/drag of a part of content + the context menu "Copy Image" case.
Assignee: nobody → mkmelin+mozilla
Status: NEW → ASSIGNED
Attachment #8809368 - Flags: review?(jorgk)
Comment on attachment 8809368 [details] [diff] [review]
bug1315480_copy_data_urls.patch

Review of attachment 8809368 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good. I haven't tested it yet. I'll get to this in the next 24 hours.

Nice effort that will keep our *Office users happy ;-)

::: mail/base/content/mailWindow.js
@@ +68,5 @@
> +  let sourceDoc = getBrowser().contentDocument;
> +  let selection = sourceDoc.getSelection();
> +  let draggedImg = null; // Will be set to the img for single image drag.
> +  for (let img of sourceDoc.images) {
> +    if (/^(http|data):/.test(img.src)) {

Further down you do:
if (/^(https?|data):/i.test(img.src)) {
Comment on attachment 8809368 [details] [diff] [review]
bug1315480_copy_data_urls.patch

Ain't workin' ;-(

Test case: HTML message with two embedded images. Select all in the original message, drag onto a composition. Result: Only one image dragged over.
Attachment #8809368 - Flags: review?(jorgk)
Attached patch bug1315480_copy_data_urls.patch (obsolete) — Splinter Review
Now all the dragged material should be copied
Attachment #8809368 - Attachment is obsolete: true
Attachment #8809525 - Flags: review?(jorgk)
Sorry, now the test case from comment #3 works, but the single image drag doesn't. It inserts a imap: URL.
Third time's a charm?
Attachment #8809538 - Flags: review?(jorgk)
Attachment #8809525 - Attachment is obsolete: true
Attachment #8809525 - Flags: review?(jorgk)
Comment on attachment 8809538 [details] [diff] [review]
bug1315480_copy_data_urls.patch

(In reply to Magnus Melin from comment #6)
> Third time's a charm?

Yep. r=jorgk.

This will keep our *Office friends happy.
Attachment #8809538 - Flags: review?(jorgk) → review+
https://hg.mozilla.org/comm-central/rev/c8666b9f31bc868950a698b2cc28896d45a09030 -> FIXED
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 52.0
Depends on: 1317031
I noticed that this doesn't work when dragging embedded images from other compose windows.

Or would you like a new bug for that?
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Yes, let's limit this bug to viewed messages.
Status: REOPENED → RESOLVED
Closed: 5 years ago5 years ago
Resolution: --- → FIXED
Summary: LibreOffice/MS Office integration: Convert image data referencing MIME parts via imap/mailbox URLs to data URLs → LibreOffice/MS Office integration: Convert image data referencing MIME parts via imap/mailbox URLs to data URLs (for viewed messages)
Blocks: 1317049
OK, to be continued in bug 1317049.
You might want to port this to SM.
Flags: needinfo?(rsx11m.pub)
Blocks: 1322155
Depends on: 1354452
Flags: needinfo?(rsx11m.pub)
You need to log in before you can comment on or make changes to this bug.