diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js index 190b03f0127..747dea9cad7 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js @@ -3705,7 +3705,7 @@ export class OdooEditor extends EventTarget { // Since the unit test Event is not trusted by the browser, we don't // need to undo the char during the unit tests. // @see https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted - this._applyRawCommand('oDeleteBackward'); + this._protect(() => this._applyRawCommand('oDeleteBackward')); } if (latestSelectionInsideEmptyTag) { // Restore the selection inside the empty Element. diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js index b5a5125d5f8..a61f35975a5 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js @@ -2053,6 +2053,9 @@ export function splitAroundUntil(elements, limitAncestor) { } export function insertText(sel, content) { + if (!content) { + return; + } if (sel.anchorNode.nodeType === Node.TEXT_NODE) { const pos = [sel.anchorNode.parentElement, splitTextNode(sel.anchorNode, sel.anchorOffset)]; setSelection(...pos, ...pos, false);