slate-hyperscript
- Version 0.100.0
- Published
- 158 kB
- 1 dependency
- MIT license
Install
npm i slate-hyperscriptyarn add slate-hyperscriptpnpm add slate-hyperscriptOverview
A hyperscript helper for creating Slate documents.
Index
Functions
function createEditor
createEditor: ( makeEditor: () => Editor) => ( tagName: string, attributes: { [key: string]: any }, children: any[]) => Editor;Create a top-level
Editorobject.
function createHyperscript
createHyperscript: (options?: { creators?: HyperscriptCreators; elements?: HyperscriptShorthands;}) => < S extends | 'anchor' | 'cursor' | 'editor' | 'element' | 'focus' | 'fragment' | 'selection' | 'text'>( tagName: S, attributes?: Object, ...children: any[]) => ReturnType< { anchor: typeof createAnchor; cursor: typeof createCursor; editor: ( tagName: string, attributes: { [key: string]: any }, children: any[] ) => any; element: typeof createElement; focus: typeof createFocus; fragment: typeof createFragment; selection: typeof createSelection; text: typeof createText; }[S]>;Create a Slate hyperscript function with
options.
function createText
createText: ( tagName: string, attributes: { [key: string]: any }, children: any[]) => Text;Create a
Textobject.
function jsx
jsx: < S extends | 'anchor' | 'cursor' | 'editor' | 'element' | 'focus' | 'fragment' | 'selection' | 'text'>( tagName: S, attributes?: Object | undefined, ...children: any[]) => ReturnType< { anchor: typeof import('./creators').createAnchor; cursor: typeof import('./creators').createCursor; editor: ( tagName: string, attributes: { [key: string]: any }, children: any[] ) => any; element: typeof import('./creators').createElement; focus: typeof import('./creators').createFocus; fragment: typeof import('./creators').createFragment; selection: typeof import('./creators').createSelection; text: typeof createText; }[S]>;The default hyperscript factory that ships with Slate, without custom tags.
Type Aliases
type HyperscriptCreators
type HyperscriptCreators<T = any> = Record< string, ( tagName: string, attributes: { [key: string]: any; }, children: any[] ) => T>;HyperscriptCreatorsare dictionaries ofHyperscriptCreatorfunctions keyed by tag name.
type HyperscriptShorthands
type HyperscriptShorthands = Record<string, Record<string, any>>;HyperscriptShorthandsare dictionaries of properties applied to specific kind of object, keyed by tag name. They allow you to easily define custom hyperscript tags for your domain.
Package Files (3)
Dependencies (1)
Dev Dependencies (3)
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/slate-hyperscript.
- Markdown[](https://www.jsdocs.io/package/slate-hyperscript)
- HTML<a href="https://www.jsdocs.io/package/slate-hyperscript"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2399 ms. - Missing or incorrect documentation? Open an issue for this package.
