summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/lib/summernote/src/js/EventHandler.js
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2018-05-07 11:16:20 +0200
committerNicolas Martinelli <nim-odoo@users.noreply.github.com>2018-05-08 08:58:22 +0200
commit5a1c78986126530ba1720e28fe10111752f0dc52 (patch)
tree486f5a96fb63368e12d0a8c6936237a7de360efb /addons/web_editor/static/lib/summernote/src/js/EventHandler.js
parent013baed41376f3b5b84bfa4a29cacb3774af6e28 (diff)
[FIX] web_editor: drag and drop
Commit 6494f511718 introduces an access token to read images inside an email. This avoids access errors when accessing the email through a proxy (e.g. Gmail). That implies that all images are added as attachments. When going through the usual media dialog, the form is submitted to action '/web_editor/attachment/add', creating the attachment. However, the copy or the drag and drop of an image completely fails. Indeed, the same method `_onImageUpload` is called, but with a completely different argument type: `attachments` is a `FileList`, not a list of attachments. To solve this, we only call `_onImageUpload` on a the custom `onUpload` callback, which is not triggered during a drag and drop or a copy. Any image included thanks to these methods will be post-processed in the `create` method of `mail.message` (`base64_to_boundary`). Unfortunately, it's not possible to simulate an actual drag and drop or a copy, so we cannot add a test. opw-1840237 opw-1840411
Diffstat (limited to 'addons/web_editor/static/lib/summernote/src/js/EventHandler.js')
-rw-r--r--addons/web_editor/static/lib/summernote/src/js/EventHandler.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/web_editor/static/lib/summernote/src/js/EventHandler.js b/addons/web_editor/static/lib/summernote/src/js/EventHandler.js
index 9701b8728d2..efa57f8111c 100644
--- a/addons/web_editor/static/lib/summernote/src/js/EventHandler.js
+++ b/addons/web_editor/static/lib/summernote/src/js/EventHandler.js
@@ -472,7 +472,8 @@ define([
onImageUpload: options.onImageUpload,
onImageUploadError: options.onImageUploadError,
onMediaDelete: options.onMediaDelete,
- onToolbarClick: options.onToolbarClick
+ onToolbarClick: options.onToolbarClick,
+ onUpload: options.onUpload,
});
var styleInfo = modules.editor.styleFromNode(layoutInfo.editable());