From f1f4ef1d8ff8bf8f7c91d1e99305b50fa7a891d0 Mon Sep 17 00:00:00 2001 From: Saurabh Mishra Date: Mon, 21 Aug 2023 13:19:31 +0000 Subject: [PATCH] [FIX] web_editor: get image source while modifying it If the user is using the `note` or any other module to add and modify images, and they try to crop the image and apply the changes, they may face an error if they try to crop it again without clicking on `apply changes` and instead click somewhere outside the image. steps to produce: - Install `note`. - Create a note, add an image in it. - Click on image to crop it, select the portion you want to crop and then click on `Apply` to apply changes. - Select the image again, click on crop icon and then click anywhere outside the image boundaries. Error: `TypeError: 'bool' object is not subscriptable`. Applying this commit will solve the issue because, after applying it, whenever `modify_image` is called, `datas` will receive the proper source. sentry-4185609374 closes odoo/odoo#133164 X-original-commit: 0c38bb37e720a3c06f59becbf9bcc78f9f978723 Signed-off-by: David Monjoie (dmo) --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 6f2e7ed10d3..acb93cb83cd 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -2745,7 +2745,7 @@ export class Wysiwyg extends Component { } const closestDialog = e.target.closest('.o_dialog, .o_web_editor_dialog'); if ( - e.target.closest('.oe-toolbar,.oe-powerbox-wrapper,.o_we_crop_buttons') || + e.target.closest('.oe-toolbar,.oe-powerbox-wrapper,.o_we_crop_widget') || (closestDialog && closestDialog.querySelector('.o_select_media_dialog, .o_link_dialog')) ) { this._shouldDelayBlur = true;