You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cudr_slate-collaborative/packages/bridge/src/apply/node/setNode.ts

19 lines
379 B

import { SetNodeOperation } from 'slate'
import { SyncValue } from '../../model'
import { getTarget } from '../../path'
const setNode = (doc: SyncValue, op: SetNodeOperation): SyncValue => {
const node = getTarget(doc, op.path)
const { newProperties } = op
for (let key in newProperties) {
node[key] = newProperties[key]
}
return doc
}
export default setNode