[FIX] web_editor: disable element hint for website

Task-2674569

closes odoo/odoo#91148

X-original-commit: 117d465eff2c79a9d17164306c17f3f87aa11848
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Nicolas Bayet
2022-05-18 09:42:48 +02:00
parent e77578550c
commit 814659b73d
3 changed files with 9 additions and 4 deletions
@@ -200,6 +200,7 @@ export class OdooEditor extends EventTarget {
toSanitize: true,
isRootEditable: true,
placeholder: false,
showEmptyElementHint: true,
defaultLinkAttributes: {},
plugins: [],
getContentEditableAreas: () => [],
@@ -2729,10 +2730,12 @@ export class OdooEditor extends EventTarget {
}
}
for (const [selector, text] of Object.entries(selectors)) {
for (const el of this.editable.querySelectorAll(selector)) {
if (!this.options.isHintBlacklisted(el)) {
this._makeHint(el, text);
if (this.options.showEmptyElementHint) {
for (const [selector, text] of Object.entries(selectors)) {
for (const el of this.editable.querySelectorAll(selector)) {
if (!this.options.isHintBlacklisted(el)) {
this._makeHint(el, text);
}
}
}
}
@@ -138,6 +138,7 @@ const Wysiwyg = Widget.extend({
isRootEditable: this.options.isRootEditable,
placeholder: this.options.placeholder,
powerboxFilters: this.options.powerboxFilters || [],
showEmptyElementHint: this.options.showEmptyElementHint,
controlHistoryFromDocument: this.options.controlHistoryFromDocument,
getContentEditableAreas: this.options.getContentEditableAreas,
defaultLinkAttributes: this.options.userGeneratedContent ? {rel: 'ugc' } : {},
@@ -417,6 +417,7 @@ var EditPageMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({
controlHistoryFromDocument: true,
getContentEditableAreas: this._getContentEditableAreas.bind(this),
powerboxCommands: this._getSnippetsCommands(),
showEmptyElementHint: false,
}, collaborationConfig);
return wysiwygLoader.createWysiwyg(this,
Object.assign(params, this.wysiwygOptions),