summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Vray <bvr@odoo.com>2020-03-10 11:28:38 +0000
committerBenjamin Vray <bvr@odoo.com>2020-03-10 18:08:20 +0000
commited1a39c61826d740e2f34f2d2d9072603021503b (patch)
treeaa5ba3ff8617d2ec36c408e7dc1e2f325de3b4a6
parent4e48c3ce0fb9d572658083cf1d42170c8f020600 (diff)
[FIX] website: avoid error if click on edit when nothing is editable
Avoid traceback when click on edit and nothing is editable on the page. task-2199214 closes odoo/odoo#47328 X-original-commit: fd92a78bd18a0fd765d9c3a857adc10e29c025dd Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
-rw-r--r--addons/web_editor/static/src/js/wysiwyg/wysiwyg_snippets.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg_snippets.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg_snippets.js
index 4cf9fd750e4..9b4b9f84222 100644
--- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg_snippets.js
+++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg_snippets.js
@@ -17,7 +17,8 @@ Wysiwyg.include({
var self = this;
this.editor = new (this.Editor)(this, this.options);
this.$editor = this.editor.rte.editable();
- await this.editor.prependTo(this.$editor[0].ownerDocument.body);
+ const $body = this.$editor[0] ? this.$editor[0].ownerDocument.body : document.body;
+ await this.editor.prependTo($body);
this._relocateEditorBar();
this.$el.on('content_changed', function (e) {
self.trigger_up('wysiwyg_change');