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.
19 lines
373 B
19 lines
373 B
import { SetNodeOperation } from 'slate'
|
|
|
|
import { SyncDoc } from '../../model'
|
|
import { getTarget } from '../../path'
|
|
|
|
const setNode = (doc: SyncDoc, op: SetNodeOperation): SyncDoc => {
|
|
const node = getTarget(doc, op.path)
|
|
|
|
const { newProperties } = op
|
|
|
|
for (let key in newProperties) {
|
|
node[key] = newProperties[key]
|
|
}
|
|
|
|
return doc
|
|
}
|
|
|
|
export default setNode
|