fix inline changes in nested nodes

This commit is contained in:
Philipinho
2026-01-31 21:59:11 +00:00
parent 70124475ab
commit 129e21f728
@@ -84,9 +84,13 @@ export function HistoryEditor({
let foundSpecialNode: { node: Node; pos: number } | null = null; let foundSpecialNode: { node: Node; pos: number } | null = null;
docNew.nodesBetween(change.fromB, change.toB, (node, pos) => { docNew.nodesBetween(change.fromB, change.toB, (node, pos) => {
if (specialNodeTypes.has(node.type.name)) { if (specialNodeTypes.has(node.type.name)) {
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 }; foundSpecialNode = { node, pos };
return false; return false;
} }
}
}); });
if (foundSpecialNode) { if (foundSpecialNode) {
@@ -110,9 +114,13 @@ export function HistoryEditor({
let foundDeletedNode: { node: Node; pos: number } | null = null; let foundDeletedNode: { node: Node; pos: number } | null = null;
docOld.nodesBetween(change.fromA, change.toA, (node, pos) => { docOld.nodesBetween(change.fromA, change.toA, (node, pos) => {
if (specialNodeTypes.has(node.type.name)) { if (specialNodeTypes.has(node.type.name)) {
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 }; foundDeletedNode = { node, pos };
return false; return false;
} }
}
}); });
if (foundDeletedNode) { if (foundDeletedNode) {