diff --git a/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js b/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js index 5e29b49e064..4c7cbc1272c 100644 --- a/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js +++ b/addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js @@ -1827,6 +1827,12 @@ export class OdooEditor extends EventTarget { const sel = this.document.getSelection(); if (!sel.anchorNode) { show = false; + } else { + const selAncestors = [sel.anchorNode, ...ancestors(sel.anchorNode, this.editable)]; + const isInStars = selAncestors.some(node => node.classList && node.classList.contains('o_stars')); + if (isInStars) { + show = false; + } } if (this.options.autohideToolbar) { if (show !== undefined && !this.isMobile) { diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 5ce049f3a6c..927c8a74a11 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -210,7 +210,9 @@ const Wysiwyg = Widget.extend({ }).join(' '); } - self.openMediaDialog(params); + if (!$el.parent().hasClass('o_stars')) { + self.openMediaDialog(params); + } }); if (options.snippets) { @@ -1369,7 +1371,7 @@ const Wysiwyg = Widget.extend({ this.toolbar.$el.find('#create-link').toggleClass('d-none', !range || spansBlocks); // Only show the media tools in the toolbar if the current selected // snippet is a media. - const isInMedia = $target.is(mediaSelector); + const isInMedia = $target.is(mediaSelector) && !$target.parent().hasClass('o_stars'); this.toolbar.$el.find([ '#image-shape', '#image-width',