Skip to content

Commit 073d92f

Browse files
committed
fix(selection): Fix getRangeContainer to handle cases where there's no selection in the document
1 parent 2738b1c commit 073d92f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/selection-watcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default class SelectionWatcher {
4646
// rangeCount is 0 or 1 in all browsers except firefox
4747
// firefox can work with multiple ranges
4848
// (on a mac hold down the command key to select multiple ranges)
49-
if (this.selection.rangeCount && successfulSync) {
49+
if (this.selection?.rangeCount && successfulSync) {
5050
const range = this.selection.getRangeAt(0)
5151
const hostNode = parser.getHost(range.commonAncestorContainer)
5252
if (hostNode) return new RangeContainer(hostNode, range)

0 commit comments

Comments
 (0)