[FIX] web_editor: fix toolbar not hiding when clicking outside of editable
Commit [1] correctly disabled some of the behaviors of the editor
that used to modify the selection outside of the editable. However,
it also had the inadvertent side-effect of disabling the toolbar
update mechanism when clicking outside of the editable.
Behavior before this commit:
When the toolbar is visible, clicking outside the editable zone
does not hide the toolbar.
Behavior after this commit:
Clicking outside of the editable zone hides the toolbar.
[1]: 07a1483967
task-3131435
closes odoo/odoo#110044
X-original-commit: 28a35a6b53493abd03e42cc30d164262c86b6de5
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
@@ -3536,6 +3536,17 @@ export class OdooEditor extends EventTarget {
|
||||
return;
|
||||
}
|
||||
|
||||
let appliedCustomSelection = false;
|
||||
if (selection.rangeCount && selection.getRangeAt(0)) {
|
||||
appliedCustomSelection = this._handleSelectionInTable();
|
||||
if (this.options.onCollaborativeSelectionChange) {
|
||||
this.options.onCollaborativeSelectionChange(this.getCurrentCollaborativeSelection());
|
||||
}
|
||||
}
|
||||
if (!appliedCustomSelection) {
|
||||
this._updateToolbar(!selection.isCollapsed && this.isSelectionInEditable(selection));
|
||||
}
|
||||
|
||||
if (
|
||||
!this.editable.contains(selection.anchorNode) &&
|
||||
!this.editable.contains(selection.focusNode)
|
||||
@@ -3567,16 +3578,6 @@ export class OdooEditor extends EventTarget {
|
||||
if (this._currentMouseState === 'mouseup') {
|
||||
this._fixFontAwesomeSelection();
|
||||
}
|
||||
let appliedCustomSelection = false;
|
||||
if (selection.rangeCount && selection.getRangeAt(0)) {
|
||||
appliedCustomSelection = this._handleSelectionInTable();
|
||||
if (this.options.onCollaborativeSelectionChange) {
|
||||
this.options.onCollaborativeSelectionChange(this.getCurrentCollaborativeSelection());
|
||||
}
|
||||
}
|
||||
if (!appliedCustomSelection) {
|
||||
this._updateToolbar(!selection.isCollapsed && this.isSelectionInEditable(selection));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user