mirror of
https://github.com/cudr/slate-collaborative.git
synced 2024-10-27 20:34:06 +00:00
fix: opSet conversion for rootKey
This commit is contained in:
parent
09985bc1f3
commit
c21172517a
@ -1,6 +1,7 @@
|
||||
import * as Automerge from 'automerge'
|
||||
|
||||
import { toSlatePath, toJS } from '../utils'
|
||||
import { rootKey } from './constants'
|
||||
|
||||
const setDataOp = (
|
||||
{ key = '', obj, path, value }: Automerge.Diff,
|
||||
@ -22,6 +23,11 @@ const opSet = (op: Automerge.Diff, [map, ops]: any, doc: any) => {
|
||||
const { link, value, path, obj, key } = op
|
||||
|
||||
try {
|
||||
// no slate op needed for root key cursor updates
|
||||
if (obj === rootKey && key === 'cursors') {
|
||||
return [map, ops]
|
||||
}
|
||||
|
||||
if (path && path[0] !== 'cursors') {
|
||||
ops.push(setDataOp(op, doc))
|
||||
} else if (map[obj]) {
|
||||
|
Loading…
Reference in New Issue
Block a user