mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
fix inline changes in nested nodes
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user