slate-hyperscript
- Version 0.125.0
- Published
- 190 kB
- No dependencies
- 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' | 'point' | '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; point: typeof createPoint; 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' | 'point' | '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; point: typeof import('./creators').createPoint; selection: typeof import('./creators').createSelection; text: typeof createText; }[S]>;The default hyperscript factory that ships with Slate, without custom tags.
Classes
class HyperscriptPointRef
class HyperscriptPointRef {}Hyperscript point refs can be used to construct arbitrary points using the ref prop of a tag.
class HyperscriptRangeRef
class HyperscriptRangeRef {}Hyperscript range refs can be used to construct arbitrary range using the ref props of and 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 (4)
Dependencies (0)
No dependencies.
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 3504 ms. - Missing or incorrect documentation? Open an issue for this package.
