From 4feaca6777dd5a44911ff7983cdbace7823e51ac Mon Sep 17 00:00:00 2001 From: abd-msyukyu-odoo <abd@odoo.com> Date: Fri, 22 Sep 2023 13:19:32 +0200 Subject: [PATCH] [FIX] web_editor: ctrl+a container should be an element If somehow there is no selection but the `_handleShortcuts` handler still gets called with `CTRL+A`, `container` would be a JQUERY object instead of an element leading to a crash in `selectNodeContents` which expects a `Node`. task-3506666 closes odoo/odoo#136289 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com> --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 08fe4e2acf39..72bac9a9bbaa 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -1686,7 +1686,7 @@ const Wysiwyg = Widget.extend({ closestElement(selection.anchorNode, containerSelector)) || // In case a suitable container could not be found then the // selection is restricted inside the editable area. - this.$editable.find(containerSelector); + this.$editable.find(containerSelector)[0]; if (container) { const range = document.createRange(); range.selectNodeContents(container); -- GitLab