From 6f14b488fb380c6a3f1b7361b9901de3f07fd9ea Mon Sep 17 00:00:00 2001 From: fja-odoo Date: Tue, 10 Sep 2019 13:17:11 +0000 Subject: [PATCH] [FIX] web_editor: fix error on section drag and drop closes odoo/odoo#36801 X-original-commit: 0ae223609a860799135e7f6764c4cb8a08979b12 Signed-off-by: Quentin Smetz (qsm) --- .../static/src/js/wysiwyg_snippets/snippets.editor.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/wysiwyg_snippets/snippets.editor.js b/addons/web_editor/static/src/js/wysiwyg_snippets/snippets.editor.js index 4193aef5332..6077dcfafae 100644 --- a/addons/web_editor/static/src/js/wysiwyg_snippets/snippets.editor.js +++ b/addons/web_editor/static/src/js/wysiwyg_snippets/snippets.editor.js @@ -88,7 +88,16 @@ var SnippetEditor = Widget.extend({ return $clone; }, start: _.bind(self._onDragAndDropStart, self), - stop: _.bind(self._onDragAndDropStop, self) + stop: function () { + // Delay our stop handler so that some summernote handlers + // which occur on mouseup (and are themself delayed) are + // executed first (this prevents the library to crash + // because our stop handler may change the DOM). + var args = arguments; + setTimeout(function () { + self._onDragAndDropStop.apply(self, args); + }, 0); + }, }); }