From 051b98d5f0469ef325aad71c69c17b84dfa0edb6 Mon Sep 17 00:00:00 2001 From: "Louis (loco)" Date: Mon, 9 Jan 2023 15:52:36 +0000 Subject: [PATCH] [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) --- 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 a969d2da19b..0d6ff3a892e 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -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);