diff --git a/source/range/InsertDelete.ts b/source/range/InsertDelete.ts index c443bf9..f6f34d4 100644 --- a/source/range/InsertDelete.ts +++ b/source/range/InsertDelete.ts @@ -134,7 +134,7 @@ const extractContentsOfRange = ( } // Merge text nodes if adjacent - node = endContainer.previousSibling; + node = endContainer && endContainer.previousSibling; if (node && node instanceof Text && endContainer instanceof Text) { endOffset = node.length; node.appendData(endContainer.data);