[FIX] web_editor: remove the possibility to edit readonly image field

Steps to reproduce the bug:
- Add multiple images on a product page
- Go to the shop and edit an image of this product by double clicking
on a small image on the carousel thumbnail
- Save
-> Nothing happens and the image is not updated

The goal of this commit is to ensure that a field of type image is not
`readonly` before adding the `contenteditable` attribute to its image.

task-3122670

closes odoo/odoo#114598

X-original-commit: 36fb7654b785888f100d5163e6cebd788c3c042a
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
This commit is contained in:
Louis (loco)
2023-03-07 19:04:18 +01:00
parent 5ee8d8fe8e
commit 051b98d5f0
@@ -283,7 +283,7 @@ const Wysiwyg = Widget.extend({
}
if ($field.data('oe-type') === "image") {
$field.attr('contenteditable', false);
$field.find('img').attr('contenteditable', true);
$field.find('img').attr('contenteditable', $field.data('oe-readonly') !== 1);
}
if ($field.is('[data-oe-many2one-id]')) {
$field.attr('contenteditable', false);