From 129e21f72870a34f8b7ee69f8de252afef3eb8bc Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Sat, 31 Jan 2026 21:59:11 +0000 Subject: [PATCH] fix inline changes in nested nodes --- .../page-history/components/history-editor.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/client/src/features/page-history/components/history-editor.tsx b/apps/client/src/features/page-history/components/history-editor.tsx index 20741662..428b727c 100644 --- a/apps/client/src/features/page-history/components/history-editor.tsx +++ b/apps/client/src/features/page-history/components/history-editor.tsx @@ -84,8 +84,12 @@ export function HistoryEditor({ let foundSpecialNode: { node: Node; pos: number } | null = null; docNew.nodesBetween(change.fromB, change.toB, (node, pos) => { if (specialNodeTypes.has(node.type.name)) { - foundSpecialNode = { node, pos }; - return false; + const nodeEnd = pos + node.nodeSize; + // Only match if change spans the entire node (not just content inside) + if (change.fromB <= pos && change.toB >= nodeEnd) { + foundSpecialNode = { node, pos }; + return false; + } } }); @@ -110,8 +114,12 @@ export function HistoryEditor({ let foundDeletedNode: { node: Node; pos: number } | null = null; docOld.nodesBetween(change.fromA, change.toA, (node, pos) => { if (specialNodeTypes.has(node.type.name)) { - foundDeletedNode = { node, pos }; - return false; + const nodeEnd = pos + node.nodeSize; + // Only match if change spans the entire node (not just content inside) + if (change.fromA <= pos && change.toA >= nodeEnd) { + foundDeletedNode = { node, pos }; + return false; + } } });