UNPKG

@curvenote/schema

Version:

Schema and markdown parser for @curvenote/editor

9 lines 431 B
import { EditorState } from 'prosemirror-state'; import { getSchema } from '../../schemas'; export function fromJSON(content, useSchema) { const schema = getSchema(useSchema); const data = typeof content === 'string' ? JSON.parse(content) : content; const state = EditorState.fromJSON({ schema }, { doc: data, selection: { type: 'text', anchor: 0, head: 0 } }); return state.doc; } //# sourceMappingURL=index.js.map