fix: insert node behavior

This commit is contained in:
Eric Maciel 2020-10-28 13:19:05 -04:00
parent 1b2f6693ee
commit 4c49a37fdb

View File

@ -19,6 +19,15 @@ const insertNodeOp = (
const ops: any = []
const iterate = ({ children, ...json }: any, path: any) => {
if (children && children.length === 1 && children[0].text === '') {
ops.push({
type: 'insert_node',
path,
node: { children, ...json }
})
return
}
const node = children ? { ...json, children: [] } : json
ops.push({