[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) <dmo@odoo.com>
This commit is contained in:
Saurabh Mishra
2023-08-28 07:11:03 +02:00
parent fca1b3a5a4
commit f1f4ef1d8f
@@ -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;