diff --git a/addons/web_editor/static/src/scss/web_editor.frontend.scss b/addons/web_editor/static/src/scss/web_editor.frontend.scss index 0b302c1b1c0..bc467ce0bbf 100644 --- a/addons/web_editor/static/src/scss/web_editor.frontend.scss +++ b/addons/web_editor/static/src/scss/web_editor.frontend.scss @@ -85,6 +85,17 @@ > img[data-shape] { object-fit: contain !important; } + + // Allowing "cover" for some hover effects. + &:not(.o_grid_item_image_contain) > img[data-shape$="geo_square"] { + &:not( + [data-hover-effect="dolly_zoom"], + [data-hover-effect="outline"], + [data-hover-effect="image_mirror_blur"], + ) { + object-fit: cover !important; + } + } } } diff --git a/addons/website/static/src/js/editor/snippets.options.js b/addons/website/static/src/js/editor/snippets.options.js index 521365d3ba1..5d2398729c8 100644 --- a/addons/website/static/src/js/editor/snippets.options.js +++ b/addons/website/static/src/js/editor/snippets.options.js @@ -4036,9 +4036,15 @@ options.registry.GridImage = options.Class.extend({ * @override */ _computeVisibility() { + // Special conditions for the hover effects. + const hasSquareShape = this.$target[0].dataset.shape === "web_editor/geometric/geo_square"; + const effectAllowsOption = !["dolly_zoom", "outline", "image_mirror_blur"] + .includes(this.$target[0].dataset.hoverEffect); + return this._super(...arguments) && !!this._getImageGridItem() - && !('shape' in this.$target[0].dataset); + && (!('shape' in this.$target[0].dataset) + || hasSquareShape && effectAllowsOption); }, /** * @override