caretPosition: fix loading when iframe is hidden

pull/5023/head
webzwo0i 2021-05-04 23:56:10 +02:00
parent 8baacd514e
commit 3c087af038
1 changed files with 1 additions and 1 deletions

View File

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