From a904a63833859e64e30fbde9d64e34568e6b39a7 Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Fri, 5 Jun 2020 10:57:23 +0000 Subject: [PATCH] [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) --- addons/web_editor/static/lib/summernote/src/js/EventHandler.js | 3 +++ 1 file changed, 3 insertions(+) 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);