mirror of
https://github.com/cudr/slate-collaborative.git
synced 2025-06-13 04:44:08 +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 * as Automerge from 'automerge'
|
||||||
|
|
||||||
import { toSlatePath, toJS } from '../utils'
|
import { toSlatePath, toJS } from '../utils'
|
||||||
|
import { rootKey } from './constants'
|
||||||
|
|
||||||
const setDataOp = (
|
const setDataOp = (
|
||||||
{ key = '', obj, path, value }: Automerge.Diff,
|
{ 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
|
const { link, value, path, obj, key } = op
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// no slate op needed for root key cursor updates
|
||||||
|
if (obj === rootKey && key === 'cursors') {
|
||||||
|
return [map, ops]
|
||||||
|
}
|
||||||
|
|
||||||
if (path && path[0] !== 'cursors') {
|
if (path && path[0] !== 'cursors') {
|
||||||
ops.push(setDataOp(op, doc))
|
ops.push(setDataOp(op, doc))
|
||||||
} else if (map[obj]) {
|
} else if (map[obj]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user