Patch #32596

fix image pasting for Edge

Added by Jens Krämer almost 2 years ago. Updated almost 2 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Attachments
Target version:-

Description

The attached patch courtesy of Planio fixes image pasting for Edge (without breaking it for other browsers) by constructing a Blob instead of a File in the paste handler.

I also amended the detailed help files where a note that IE and Edge are not supported has recently been added (#32552). Lacking the language skills I did not change the japanese files, that would still have to be done.

0001-fixes-image-pasting-for-Edge-3816-32552.patch Magnifier (108 KB) Jens Krämer, 2019-12-10 12:36

0001-fixes-image-pasting-for-Edge-3816-32552.patch Magnifier - Patch including the fix from Note #2 (108 KB) Jens Krämer, 2019-12-11 07:21


Related issues

Related to Redmine - Patch #32552: Clarify that pasting images from clipboard does not suppo... Closed
Related to Redmine - Feature #3816: Allow pasting screenshots from clipboard Closed 2009-09-03

Associated revisions

Revision 19356
Added by Go MAEDA almost 2 years ago

Fixes image pasting for Edge (#3816, #32552, #32596).

Patch by Jens Krämer.

Revision 19357
Added by Go MAEDA almost 2 years ago

Merged r19356 from trunk to 4.1-stable (#3816, #32552, #32596).

History

#1 Updated by Yuichi HARADA almost 2 years ago

@Jens Krämer, thank you for providing a great patch. However, nothing is displayed on the preview screen immediately after the image is pasted (all of the browsers except IE).
If you add the following patch together, it will work.

diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js
index 645038284..053ef076a 100644
--- a/public/javascripts/attachments.js
+++ b/public/javascripts/attachments.js
@@ -103,7 +103,7 @@ function uploadBlob(blob, uploadUrl, attachmentId, options) {
   }, options);

   uploadUrl = uploadUrl + '?attachment_id=' + attachmentId;
-  if (blob instanceof window.File) {
+  if (blob instanceof window.Blob) {
     uploadUrl += '&filename=' + encodeURIComponent(blob.name);
     uploadUrl += '&content_type=' + encodeURIComponent(blob.type);
   }

#2 Updated by Jens Krämer almost 2 years ago

Thanks for pointing this out! Attached is a new patch including the above fix.

#3 Updated by Marius BALTEANU almost 2 years ago

  • Related to Patch #32552: Clarify that pasting images from clipboard does not support Internet Explorer added

#4 Updated by Marius BALTEANU almost 2 years ago

  • Related to Feature #3816: Allow pasting screenshots from clipboard added

#5 Updated by Marius BALTEANU almost 2 years ago

  • Target version set to Candidate for next major release

Thanks Jens and Yuichi for fixing this issue on Edge. I propose to commit this as part of the related issues.

#6 Updated by Marius BALTEANU almost 2 years ago

  • Assignee set to Go MAEDA

#7 Updated by Go MAEDA almost 2 years ago

  • Category set to Attachments
  • Status changed from New to Closed
  • Target version deleted (Candidate for next major release)

Committed the fix. Thank you for improving the feature.

Also available in: Atom PDF