fix: use isCollapsed instead of rangeCount (#3581)

This commit is contained in:
Hasan Özbey 2022-08-17 15:56:03 +03:00 committed by GitHub
parent 974f003fe3
commit 11a9b73610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@
export default function selectedText(body) {
const selection = window.getSelection();
if (selection?.rangeCount) {
if (!selection.isCollapsed) {
const range = selection.getRangeAt(0);
const parent = range.commonAncestorContainer;