mirror of
https://github.com/cudr/slate-collaborative.git
synced 2026-03-02 03:40:18 +00:00
feat: add test annotations
This commit is contained in:
@@ -15,18 +15,20 @@ const insertNodeOp = ({ value, obj, index, path }: Automerge.Diff) => map => {
|
||||
const inserate = ({ nodes, ...json }: any, path) => {
|
||||
const node = nodes ? { ...json, nodes: [] } : json
|
||||
|
||||
if (node.object === 'mark') {
|
||||
ops.push({
|
||||
type: 'add_mark',
|
||||
path: path.slice(0, -1),
|
||||
mark: node
|
||||
})
|
||||
} else {
|
||||
ops.push({
|
||||
type: 'insert_node',
|
||||
path,
|
||||
node
|
||||
})
|
||||
if (node.object) {
|
||||
if (node.object === 'mark') {
|
||||
ops.push({
|
||||
type: 'add_mark',
|
||||
path: path.slice(0, -1),
|
||||
mark: node
|
||||
})
|
||||
} else {
|
||||
ops.push({
|
||||
type: 'insert_node',
|
||||
path,
|
||||
node
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
nodes && nodes.forEach((n, i) => inserate(n, [...path, i]))
|
||||
|
||||
@@ -21,7 +21,7 @@ const opSet = (op: Automerge.Diff, [map, ops]) => {
|
||||
|
||||
if (set && path) {
|
||||
ops.push(set(op))
|
||||
} else {
|
||||
} else if (map[obj]) {
|
||||
map[obj][key] = link ? map[value] : value
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user