Skip to content

Commit

Permalink
[FIX] web_editor: disable element hint for website
Browse files Browse the repository at this point in the history
Task-2674569

closes odoo#82288

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
  • Loading branch information
Goaman committed May 11, 2022
1 parent 20928ab commit 117d465
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
11 changes: 7 additions & 4 deletions addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ export class OdooEditor extends EventTarget {
toSanitize: true,
isRootEditable: true,
placeholder: false,
showEmptyElementHint: true,
defaultLinkAttributes: {},
plugins: [],
getContentEditableAreas: () => [],
Expand Down Expand Up @@ -2631,10 +2632,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);
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions addons/web_editor/static/src/js/wysiwyg/wysiwyg.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ const Wysiwyg = Widget.extend({
autohideToolbar: !!this.options.autohideToolbar,
isRootEditable: this.options.isRootEditable,
placeholder: this.options.placeholder,
showEmptyElementHint: this.options.showEmptyElementHint,
controlHistoryFromDocument: this.options.controlHistoryFromDocument,
getContentEditableAreas: this.options.getContentEditableAreas,
defaultLinkAttributes: this.options.userGeneratedContent ? {rel: 'ugc' } : {},
Expand Down
1 change: 1 addition & 0 deletions addons/website/static/src/js/menu/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ var EditPageMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({
getContentEditableAreas: this._getContentEditableAreas.bind(this),
powerboxCommands: this._getSnippetsCommands(),
bindLinkTool: true,
showEmptyElementHint: false,
}, collaborationConfig);
return wysiwygLoader.createWysiwyg(this,
Object.assign(params, this.wysiwygOptions),
Expand Down

0 comments on commit 117d465

Please sign in to comment.