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 d02e4bc94f9..ca88dc6303a 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 @@ -2116,6 +2116,15 @@ export class OdooEditor extends EventTarget { return didDeselectTable; } + /** + * `activateContenteditable` serves as an interface for external use, + * allowing users to conveniently trigger `_activateContenteditable` + * from outside the odooEditor. + */ + activateContenteditable() { + this._activateContenteditable(); + } + //-------------------------------------------------------------------------- // Private //-------------------------------------------------------------------------- diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 7cc8ccfeda9..88fb521e82e 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -2304,7 +2304,8 @@ export class Wysiwyg extends Component { `).childNodes[0]; this.odooEditor.execCommand('insert', bannerElement); - setSelection(bannerElement.querySelector('.o_editor_banner > div'), 0); + this.odooEditor.activateContenteditable(); + setSelection(bannerElement.querySelector('.o_editor_banner > div > p'), 0); }, } } diff --git a/addons/web_editor/static/tests/banner_tests.js b/addons/web_editor/static/tests/banner_tests.js index 4559ad42e97..174eb7bc527 100644 --- a/addons/web_editor/static/tests/banner_tests.js +++ b/addons/web_editor/static/tests/banner_tests.js @@ -81,5 +81,24 @@ QUnit.module(
Test