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.
24 lines
366 B
24 lines
366 B
import * as Automerge from 'automerge'
|
|
|
|
const toSync = (node: any) => {
|
|
if (!node) {
|
|
return
|
|
}
|
|
|
|
if (node.hasOwnProperty('text')) {
|
|
return {
|
|
...node,
|
|
text: new Automerge.Text(node.text)
|
|
}
|
|
} else if (node.children) {
|
|
return {
|
|
...node,
|
|
children: node.children.map(toSync)
|
|
}
|
|
}
|
|
|
|
return node
|
|
}
|
|
|
|
export default toSync
|