[FIX] web_editor: show/hide toolbar on click in editor document

We need to check the selection on click in the editor's document so as
to update the visibility of the toolbar (we want to hide it if the
selection is in a non-editable area). When the editor was in an iframe
however, the wrong document was targeted: we want to check on clicks in
the editor's document, not the top document.

closes odoo/odoo#69775

X-original-commit: b0429c96e30751390991a9471a4c031dfed98d81
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Antoine Guenet
2021-04-23 15:25:33 +00:00
parent e08ee893d1
commit 002cdcab0a
@@ -1168,7 +1168,7 @@ var SnippetsMenu = Widget.extend({
this.customizePanel.classList.add('o_we_customize_panel', 'd-none');
this._addToolbar();
this._checkEditorToolbarVisibilityCallback = this._checkEditorToolbarVisibility.bind(this)
$(document.body).on('click', this._checkEditorToolbarVisibilityCallback);
$(this.options.wysiwyg.odooEditor.document.body).on('click', this._checkEditorToolbarVisibilityCallback);
if (this.options.enableTranslation) {
// Load the sidebar with the style tab only.