From 38daca0099ab45b5315f2dfeb1708b0d7976ad5e Mon Sep 17 00:00:00 2001 From: 01zulfi <85733202+01zulfi@users.noreply.github.com> Date: Mon, 3 Nov 2025 09:01:09 +0500 Subject: [PATCH] editor: fix crash in heading plugin when pasting markdown content Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> --- packages/editor/src/extensions/heading/heading.ts | 2 ++ 1 file changed, 2 insertions(+) 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 &&