[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
This commit is contained in:
Younn Olivier
2021-08-05 08:10:24 +00:00
parent a37f27d08f
commit 5f41733eb7
3 changed files with 3 additions and 1 deletions
@@ -1152,6 +1152,7 @@ var SnippetsMenu = Widget.extend({
'.ui-autocomplete',
'.modal .close',
'.o_we_crop_widget',
'.transfo-container',
].join(', ');
this.loadingTimers = {};
@@ -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 => {
@@ -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