[FIX] web_editor: do not display quality options on SVGs/GIFs

When the width and quality option for images was moved from the
optimize-dialog to the left-panel, it was made available on all image
types. However, width and quality options don't make sense on SVGs and
would break animated gifs. This commit makes it so that quality options
are only available on JPEG and PNG images.

closes odoo/odoo#57564

X-original-commit: 315be6f4765268eada4b39a637136c86a30720eb
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
Samuel Degueldre
2020-09-11 15:30:49 +00:00
parent a92b44dbd6
commit 9733bdfdc0
@@ -3109,7 +3109,11 @@ const ImageHandlerOption = SnippetOptionWidget.extend({
* @override
*/
_computeVisibility() {
const src = this._getImg().getAttribute('src');
const img = this._getImg();
if (!['image/jpeg', 'image/png'].includes(img.dataset.mimetype)) {
return false;
}
const src = img.getAttribute('src');
return src && src !== '/';
},
/**