import * as Automerge from 'automerge' ; import { toSync } from '../' ; import { Node } from 'slate' ; export const createText = ( text = '' ) => ( { text } ) ; export const createNode = ( type = 'paragraph' , text = '' , data ? ) => ( { type , children : [ createText ( text ) ] , ... data } ) ; export const createValue = ( children ? ) : { children : Node [ ] ; } => ( { children : children || [ createNode ( ) ] } ) ; export const createDoc = ( children ? ) => Automerge . from ( toSync ( createValue ( children ) ) ) ; export const cloneDoc = ( doc ) => Automerge . change ( doc , '' , d => d ) ;