[IMP] web_editor: prevent icon and text tools in stars widget
When clicking, double clicking or triple clicking in the stars widget of the Powerbox, we don't want to see the regular options of icons or text. This prevents them from showing. task-2575449 closes odoo/odoo#81920 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user