From abc6dbdc765ac36a98d0e07efba62379ddf7e26b Mon Sep 17 00:00:00 2001 From: Jason Van Malder Date: Mon, 30 Dec 2019 11:00:31 +0000 Subject: [PATCH] [FIX] web_editor: fix summernote text drop on firefox Issue - Have firefox - Go to any chatter - Open full editor - Write some "test" words with line breaks - Select one of your "test" words - Drag & drop it somewhere else in the editor Welcome on test.com! (redirected) Cause Summernote doesn't preventDefault on drop event, so firefox think we want to go to another URL. Solution Add the preventDefault manually. This reveals another issue which is solved by importing this PR's code https://github.com/summernote/summernote/pull/3327 (with adaptation for our dinosaurus version) OPW-2158112 closes odoo/odoo#42759 X-original-commit: 197145ac19fd65dcfbcbae81c8b5dd54025185a4 Signed-off-by: Jason Van Malder --- .../static/lib/summernote/src/js/module/DragAndDrop.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/web_editor/static/lib/summernote/src/js/module/DragAndDrop.js b/addons/web_editor/static/lib/summernote/src/js/module/DragAndDrop.js index b8871599c6f..9e96dc329eb 100644 --- a/addons/web_editor/static/lib/summernote/src/js/module/DragAndDrop.js +++ b/addons/web_editor/static/lib/summernote/src/js/module/DragAndDrop.js @@ -70,6 +70,10 @@ define([ var dataTransfer = event.originalEvent.dataTransfer; var layoutInfo = dom.makeLayoutInfo(event.currentTarget || event.target); + /* ODOO: start_modification */ + event.preventDefault(); + /* ODOO: end_modification */ + if (dataTransfer && dataTransfer.files && dataTransfer.files.length) { event.preventDefault(); layoutInfo.editable().focus(); @@ -83,6 +87,12 @@ define([ var type = dataTransfer.types[i]; var content = dataTransfer.getData(type); + /* ODOO: start_modification */ + if (type.toLowerCase().indexOf('_moz_') > -1) { + return; + } + /* ODOO: end_modification */ + if (type.toLowerCase().indexOf('text') > -1) { layoutInfo.holder().summernote('pasteHTML', content); } else {