summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/editor
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2020-02-06 17:58:59 +0000
committerqsm-odoo <qsm@odoo.com>2020-02-10 14:28:34 +0000
commit0ac7d67c5fa1ba94fdadf8d6563568bdaf28e009 (patch)
treed6bae2ae7e52efa0eb757aea860d23bb866b1057 /addons/web_editor/static/src/js/editor
parent32a8b4dce37c256acd562f898f6e70d5aed8109b (diff)
[FIX] web_editor: fix gallery blocking the editor after image reordering
When snippets deeply alter the DOM (e.g. image reordering in gallery), the related option might be destroyed since they are referencing old DOM. If such a case occurred, the destroyed option was still waiting for an option update response by the editor before being considered as finished... which then never occurred and blocked the editor. closes odoo/odoo#44998 X-original-commit: 9eeea4c4107dc15984c475582d5ee58a17cd2568 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_editor/static/src/js/editor')
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.options.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js
index 38b3045040c..11f54264f20 100644
--- a/addons/web_editor/static/src/js/editor/snippets.options.js
+++ b/addons/web_editor/static/src/js/editor/snippets.options.js
@@ -2107,6 +2107,13 @@ const SnippetOptionWidget = Widget.extend({
await this._select(previewMode, widget);
this.$target.trigger('content_changed');
+ // Enabling an option and notifying that the $target has changed
+ // may destroy the option (if the DOM is altered in such a way the
+ // option is not attached to it anymore). In that case, we must not
+ // wait for a response to the option update.
+ if (this.isDestroyed()) {
+ return;
+ }
await new Promise(resolve => {
// Will update the UI of the correct widgets for all options
// related to the same $target/editor if necessary