caretPosition: fix loading when iframe is hidden

This commit is contained in:
webzwo0i 2021-05-04 23:56:10 +02:00
parent 8baacd514e
commit 3c087af038

View file

@ -195,7 +195,7 @@ const getSelectionRange = () => {
return; return;
} }
const selection = window.getSelection(); const selection = window.getSelection();
if (selection.rangeCount > 0) { if (selection && selection.type !== 'None' && selection.rangeCount > 0) {
return selection.getRangeAt(0); return selection.getRangeAt(0);
} else { } else {
return null; return null;