From 9b3c4e3504713f70be034aa15d217aecb3e0f166 Mon Sep 17 00:00:00 2001 From: Nicolas Bayet Date: Wed, 17 Nov 2021 15:35:53 +0000 Subject: [PATCH] [FIX] web_editor: avoid editor history on image cropper In some circumstance, the image cropper is being reverted by the Odoo editor unbreakable mechanics. The reason was that the cropper tool was appended inside the editable rather than outside the editable. Task-2693553 closes odoo/odoo#80613 X-original-commit: c09600fe35089cdaed34ec12d8bcb992d24e043f Signed-off-by: David Monjoie (dmo) --- addons/web_editor/static/src/js/editor/snippets.options.js | 4 ++-- 1 file changed, 2 insertions(+), 2 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 83349749388..966a5280861 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -5057,7 +5057,7 @@ registry.ImageTools = ImageHandlerOption.extend({ async crop() { this.trigger_up('hide_overlay'); this.trigger_up('disable_loading_effect'); - new weWidgets.ImageCropWidget(this, this.$target[0]).appendTo(this.options.wysiwyg.$editable); + new weWidgets.ImageCropWidget(this, this.$target[0]).appendTo(this.options.wysiwyg.odooEditor.document.body); await new Promise(resolve => { this.$target.one('image_cropper_destroyed', async () => { @@ -5098,7 +5098,7 @@ registry.ImageTools = ImageHandlerOption.extend({ */ async resetCrop() { const cropper = new weWidgets.ImageCropWidget(this, this.$target[0]); - await cropper.appendTo(this.options.wysiwyg.$editable); + await cropper.appendTo(this.options.wysiwyg.odooEditor.document.body); await cropper.reset(); await this._reapplyCurrentShape(); },