Skip to content

Commit

Permalink
[FIX] web_editor: fix summernote text drop on firefox
Browse files Browse the repository at this point in the history
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 summernote/summernote#3327
    (with adaptation for our dinosaurus version)

OPW-2158112

closes odoo#42470

Signed-off-by: Jason Van Malder <jvm-odoo@users.noreply.github.com>
  • Loading branch information
Jason Van Malder committed Dec 30, 2019
1 parent 04dff5a commit bc5ecc2
Showing 1 changed file with 10 additions and 0 deletions.
Expand Up @@ -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();
Expand All @@ -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 {
Expand Down

0 comments on commit bc5ecc2

Please sign in to comment.