diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index 0b769afde97..d3fd4442efc 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -7410,6 +7410,10 @@ registry.ImageTools = ImageHandlerOption.extend({ * @returns {boolean} */ _canHaveHoverEffect() { + // TODO Remove this comment in master: + // Note that this method does not ensure that a shape can be applied, + // which is required for hover effects. It should be preferably merged + // with the `_isImageSupportedForShapes()` method. return !this._isDeviceShape() && !this._isAnimatedShape(); }, /** @@ -7570,6 +7574,16 @@ registry.ImageTools = ImageHandlerOption.extend({ } } }, + /** + * Checks if a shape can be applied on the target. + * + * @private + * @returns {boolean} + */ + _isImageSupportedForShapes() { + const imgEl = this._getImg(); + return imgEl.dataset.originalId && this._isImageSupportedForProcessing(imgEl); + }, //-------------------------------------------------------------------------- // Handlers diff --git a/addons/website/static/src/js/editor/snippets.options.js b/addons/website/static/src/js/editor/snippets.options.js index 2bbaa9f5e33..d8f8b0246e3 100644 --- a/addons/website/static/src/js/editor/snippets.options.js +++ b/addons/website/static/src/js/editor/snippets.options.js @@ -3655,7 +3655,7 @@ options.registry.WebsiteAnimate = options.Class.extend({ const hoverEffectWidget = hoverEffectOverlayWidget.getParent(); const imageToolsOpt = hoverEffectWidget.getParent(); return ( - imageToolsOpt._canHaveHoverEffect() + imageToolsOpt._canHaveHoverEffect() && imageToolsOpt._isImageSupportedForShapes() && !await isImageCorsProtected(this.$target[0]) ); }