Skip to content

Commit b8cfdfb

Browse files
Zyntondmo-odoo
authored andcommitted
[FIX] prevent toolbar from appearing on selection outside editable
1 parent ae9c0a6 commit b8cfdfb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/editor.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,10 @@ export class OdooEditor extends EventTarget {
13251325
this._computeHistoryCursor();
13261326

13271327
const selection = this.document.defaultView.getSelection();
1328-
this._updateToolbar(!selection.isCollapsed);
1328+
const isSelectionInEditable = !selection.isCollapsed &&
1329+
this.editable.contains(selection.anchorNode) &&
1330+
this.editable.contains(selection.focusNode);
1331+
this._updateToolbar(isSelectionInEditable);
13291332

13301333
if (this._currentMouseState === 'mouseup') {
13311334
this._fixFontAwesomeSelection();

0 commit comments

Comments
 (0)