Skip to content

Commit

Permalink
[FIX] web_editor: fix toolbar not hiding when clicking outside of edi…
Browse files Browse the repository at this point in the history
…table

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]: 07a1483

task-3131435

closes odoo#109914

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
  • Loading branch information
dmo-odoo committed Jan 16, 2023
1 parent 840a867 commit 28a35a6
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3467,6 +3467,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)
Expand Down Expand Up @@ -3498,16 +3509,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));
}
}

/**
Expand Down

0 comments on commit 28a35a6

Please sign in to comment.