[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>
This commit is contained in:
committed by
qsm-odoo
parent
4f64fa3e78
commit
a904a63833
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user