slate-hyperscript
import h from 'slate-hyperscript'
import { createHyperscript } from 'slate-hyperscript'A hyperscript helper for writing Slate documents with JSX!
Example
/** @jsx h */
import h from 'slate-hyperscript'
const value = (
<value>
<document>
<block type="paragraph">
A string of <mark type="bold">bold</mark> in a{' '}
<inline type="link" data={{ src: 'http://slatejs.org' }}>
Slate
</inline>{' '}
editor!
</block>
<block type="image" data={{ src: 'https://...' }} isVoid />
</document>
</value>
)Exports
h
hFunction
The default export of slate-hyperscript is a barebones hyperscript helper that you can immediately start using to create Slate objects.
createHyperscript
createHyperscriptcreateHyperscript(options: Object) => Function
The other export is a createHyperscript helper that you can use to create your own, smarter, schema-aware hyperscript helper. You can pass it options that tell it about your schema to make creating objects much terser.
Last updated