Skip to content
Snippets Groups Projects
Commit 2685b02b authored by chris's avatar chris
Browse files

accept block changes

parent be700e1e
No related branches found
No related tags found
1 merge request!143Track changes
......@@ -33,6 +33,19 @@ class AcceptTrackChange extends Tools {
);
tr.step(deletionStep);
map.appendMap(deletionStep.getMap());
} else if (
node.attrs.track &&
node.attrs.track.find(track => track.type === 'insertion')
) {
const track = node.attrs.track.filter(
track => track.type !== 'insertion',
);
tr.setNodeMarkup(
map.map(pos),
null,
Object.assign(node.attrs.track, { track }),
node.marks,
);
} else if (
node.marks &&
node.marks.find(mark => mark.type.name === 'insertion')
......@@ -61,6 +74,24 @@ class AcceptTrackChange extends Tools {
formatChangeMark,
),
);
} else if (
node.attrs.track &&
node.attrs.track.find(track => track.type === 'block_change')
) {
const blockChangeTrack = node.attrs.track.find(
track => track.type === 'block_change',
);
const track = node.attrs.track.filter(
track => track !== blockChangeTrack,
);
tr.setNodeMarkup(
map.map(pos),
null,
Object.assign(node.attrs.track, { track }),
node.marks,
);
}
});
if (tr.steps.length) dispatch(tr);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment