summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/lib
diff options
context:
space:
mode:
authorSamuel Degueldre <sad@odoo.com>2020-06-05 10:57:23 +0000
committerqsm-odoo <qsm@odoo.com>2020-06-05 16:33:21 +0000
commita904a63833859e64e30fbde9d64e34568e6b39a7 (patch)
tree793b9a05424e325316263a911463b14a9023ef67 /addons/web_editor/static/lib
parent4f64fa3e78b480b8e0dc7fc903d2f8f2e7107d82 (diff)
[FIX] web_editor: fix layoutInfo is null traceback
When attempting to update its UI in reaction to events, summernote tries to make layout info for the event target, this relies on finding this information on one of the target's ancestors. In some cases, elements can be removed from the DOM between the moment the event was triggered, and the moment summernote attempts to create the layoutInfo, resulting in layoutInfo being null. This commit prevents tracebacks from happening in such cases by checking that a layoutInfo was actually returned, and if not, aborting the UI update that relies on it. closes odoo/odoo#52541 X-original-commit: 3e999db0c114d51102ae51f870f98a4cc276c4b4 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_editor/static/lib')
-rw-r--r--addons/web_editor/static/lib/summernote/src/js/EventHandler.js3
1 files changed, 3 insertions, 0 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 a924e7def8a..a1243c6f30d 100644
--- a/addons/web_editor/static/lib/summernote/src/js/EventHandler.js
+++ b/addons/web_editor/static/lib/summernote/src/js/EventHandler.js
@@ -206,6 +206,9 @@ define([
setTimeout(function () {
var layoutInfo = dom.makeLayoutInfo(target);
/* ODOO: (start_modification */
+ if (!layoutInfo) {
+ return;
+ }
var $editable = layoutInfo.editable();
if (event.setStyleInfoFromEditable) {
var styleInfo = modules.editor.styleFromNode($editable);