[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 <jvm-odoo@users.noreply.github.com>
This commit is contained in:
Jason Van Malder
2020-01-06 13:11:10 +00:00
parent 76723b98c1
commit abc6dbdc76
@@ -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 {