diff --git a/addons/web_editor/static/src/js/editor/image_processing.js b/addons/web_editor/static/src/js/editor/image_processing.js index 84fdd77d414..afafb7d707b 100644 --- a/addons/web_editor/static/src/js/editor/image_processing.js +++ b/addons/web_editor/static/src/js/editor/image_processing.js @@ -461,7 +461,23 @@ function isImageSupportedForProcessing(mimetype, strict = false) { * @returns {Boolean} */ function isImageSupportedForStyle(img) { - return img.parentElement && !img.parentElement.dataset.oeType; + if (!img.parentElement) { + return false; + } + + // See also `[data-oe-type='image'] > img` added as data-exclude of some + // snippet options. + const isTFieldImg = ('oeType' in img.parentElement.dataset); + + // Editable root elements are technically *potentially* supported here (if + // the edited attributes are not computed inside the related view, they + // could technically be saved... but as we cannot tell the computed ones + // apart from the "static" ones, we choose to not support edition at all in + // those "root" cases). + // See also `[data-oe-xpath]` added as data-exclude of some snippet options. + const isEditableRootElement = ('oeXpath' in img.dataset); + + return !isTFieldImg && !isEditableRootElement; } /** diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 83b81c79df3..846d5ed5fd9 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -38,7 +38,9 @@ const endPos = OdooEditorLib.endPos; var id = 0; const faZoomClassRegex = RegExp('fa-[0-9]x'); -const mediaSelector = 'img, .fa, .o_image, .media_iframe_video'; +const basicMediaSelector = 'img, .fa, .o_image, .media_iframe_video'; +// (see isImageSupportedForStyle). +const mediaSelector = basicMediaSelector.split(',').map(s => `${s}:not([data-oe-xpath])`).join(','); // Time to consider a user offline in ms. This fixes the problem of the // navigator closing rtc connection when the mac laptop screen is closed. diff --git a/addons/web_editor/views/snippets.xml b/addons/web_editor/views/snippets.xml index b79b83e475b..65c369df0d4 100644 --- a/addons/web_editor/views/snippets.xml +++ b/addons/web_editor/views/snippets.xml @@ -382,7 +382,9 @@ -
+
Replace
-
+
-
+
-
+
None Left diff --git a/addons/website/views/snippets/snippets.xml b/addons/website/views/snippets/snippets.xml index 25c5b40a2d5..bdf99385bb7 100644 --- a/addons/website/views/snippets/snippets.xml +++ b/addons/website/views/snippets/snippets.xml @@ -1243,7 +1243,7 @@
+ data-exclude="[data-oe-xpath], .o_not-animable, .s_col_no_resize.row > div, .s_col_no_resize"> No Animation