From 5f41733eb7a40f6e335fdd257d984a3707e33469 Mon Sep 17 00:00:00 2001 From: Younn Olivier Date: Tue, 8 Jun 2021 07:37:33 +0000 Subject: [PATCH] [FIX] web_editor: keep options and hide overlay when transforming an img Part of https://github.com/odoo/odoo/pull/74592 task-2554608 X-original-commit: 1e8ab0c9de57c7c0dcf92fa5199ff1d1f226ca47 --- addons/web_editor/static/src/js/editor/snippets.editor.js | 1 + addons/web_editor/static/src/js/editor/snippets.options.js | 2 ++ .../static/src/js/wysiwyg/widgets/image_crop_widget.js | 1 - 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 3955369690e..5c24a1804f8 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -1152,6 +1152,7 @@ var SnippetsMenu = Widget.extend({ '.ui-autocomplete', '.modal .close', '.o_we_crop_widget', + '.transfo-container', ].join(', '); this.loadingTimers = {}; 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 062fdf47444..20fce9fbd2d 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -4173,6 +4173,7 @@ registry.ReplaceMedia = SnippetOptionWidget.extend({ */ registry.ImageTools = SnippetOptionWidget.extend({ crop() { + this.trigger_up('hide_overlay'); new weWidgets.ImageCropWidget(this, this.$target[0]).appendTo(this.options.wysiwyg.$editable); }, transform() { @@ -4180,6 +4181,7 @@ registry.ImageTools = SnippetOptionWidget.extend({ this.$target.removeData('transfo-destroy'); return; } + this.trigger_up('hide_overlay'); const document = this.$target[0].ownerDocument; this.$target.transfo({document}); const mousedown = mousedownEvent => { diff --git a/addons/web_editor/static/src/js/wysiwyg/widgets/image_crop_widget.js b/addons/web_editor/static/src/js/wysiwyg/widgets/image_crop_widget.js index 5aaa7762ddf..4c9846b8b9f 100644 --- a/addons/web_editor/static/src/js/wysiwyg/widgets/image_crop_widget.js +++ b/addons/web_editor/static/src/js/wysiwyg/widgets/image_crop_widget.js @@ -82,7 +82,6 @@ const ImageCropWidget = Widget.extend({ await loadImage(this.originalSrc, cropperImage); await activateCropper(cropperImage, this.aspectRatios[this.aspectRatio].value, this.media.dataset); - core.bus.trigger('deactivate_snippet'); this._onDocumentMousedown = this._onDocumentMousedown.bind(this); // We use capture so that the handler is called before other editor handlers