From ffb50cdb4093cfd1568c731663ddec50916c6eec Mon Sep 17 00:00:00 2001 From: Hugo BANNIER Date: Fri, 17 Feb 2023 10:52:40 +0000 Subject: [PATCH] bugfix: avoid bug if domSelection is not displayed in the webpage --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 6e1ba09c..4379bf72 100644 --- a/src/index.ts +++ b/src/index.ts @@ -195,7 +195,7 @@ export class EditorView { // Chrome sometimes starts misreporting the selection, so this // tracks that and forces a selection reset when our update // did write to the node. - let chromeKludge = browser.chrome ? (this.trackWrites = this.domSelectionRange().focusNode) : null + let chromeKludge = browser.chrome ? (this.trackWrites = this.domSelectionRange()?.focusNode) : null if (redraw || !this.docView.update(state.doc, outerDeco, innerDeco, this)) { this.docView.updateOuterDeco([]) this.docView.destroy()