Patch #32596
closed
fix image pasting for Edge
Added by Jens Krämer almost 5 years ago.
Updated almost 5 years ago.
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.
Files
Jens Priesen 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);
}
Thanks for pointing this out! Attached is a new patch including the above fix.
- Related to Patch #32552: Clarify that pasting images from clipboard does not support Internet Explorer added
- Related to Feature #3816: Allow pasting screenshots from clipboard added
- 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.
- 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