From 74013202c6e5b753305d366ea97eb755d3a4c233 Mon Sep 17 00:00:00 2001 From: abd-msyukyu-odoo 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#136499 X-original-commit: e6fac045282465960c0e4a7ecbbbb5e5ac8dff92 Signed-off-by: David Monjoie (dmo) Signed-off-by: Damien Abeloos (abd) --- 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 2e7bf565d2b..56e6a3bbbbc 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -2064,7 +2064,7 @@ export class Wysiwyg extends Component { 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);