[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) <dmo@odoo.com>
This commit is contained in:
Nicolas Bayet
2021-11-30 15:22:19 +00:00
parent eded149595
commit 9b3c4e3504
@@ -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();
},