Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: fix crash in heading plugin when pasting markdown content Signed-off-by: 01zulfi <[email protected]>

01zulfi38daca0099ab
diff --git a/packages/editor/src/extensions/heading/heading.ts b/packages/editor/src/extensions/heading/heading.ts
index b7f73d74f..465e8d471 100644
--- a/packages/editor/src/extensions/heading/heading.ts
+++ b/packages/editor/src/extensions/heading/heading.ts
@@ -365,6 +365,8 @@ const headingUpdatePlugin = new Plugin({
newDoc.descendants((newNode, pos) => {
if (newNode.type.name === "heading") {
+ if (pos >= oldDoc.content.size) return;
+
const oldNode = oldDoc.nodeAt(pos);
if (
oldNode &&