mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-16 20:24:01 +02:00
GitBook: [main] 58 pages and 7 assets modified
This commit is contained in:
committed by
gitbook-bot
parent
15966086d4
commit
a38957b849
@@ -13,3 +13,4 @@ This sub-library tracks changes to the Slate value state over time, and enables
|
||||
## `withHistory`
|
||||
|
||||
The `withHistory` plugin keeps track of the operation history of a Slate editor as operations are applied to it, using undo and redo stacks.
|
||||
|
||||
|
@@ -1,3 +1,4 @@
|
||||
# Slate Hyperscript
|
||||
|
||||
This package contains a hyperscript helper for creating Slate documents with JSX!
|
||||
|
||||
|
@@ -6,27 +6,27 @@ This sub-library contains the React-specific logic for Slate.
|
||||
|
||||
React components for rendering Slate editors
|
||||
|
||||
###### `RenderElementProps`
|
||||
### `RenderElementProps`
|
||||
|
||||
`RenderElementProps` are passed to the `renderElement` handler.
|
||||
|
||||
###### `RenderLeafProps`
|
||||
### `RenderLeafProps`
|
||||
|
||||
`RenderLeafProps` are passed to the `renderLeaf` handler.
|
||||
|
||||
###### `Editable`
|
||||
### `Editable`
|
||||
|
||||
The main Slate editor.
|
||||
|
||||
###### `DefaultElement(props: RenderElementProps)`
|
||||
### `DefaultElement(props: RenderElementProps)`
|
||||
|
||||
The default element renderer.
|
||||
|
||||
###### `DefaultLeaf(props: RenderLeafProps)`
|
||||
### `DefaultLeaf(props: RenderLeafProps)`
|
||||
|
||||
The default custom leaf renderer.
|
||||
|
||||
###### `Slate(editor: ReactEditor, value: Node[], children: React.ReactNode, onChange: (value: Node[]) => void, [key: string]: any)`
|
||||
### `Slate(editor: ReactEditor, value: Node[], children: React.ReactNode, onChange: (value: Node[]) => void, [key: string]: any)`
|
||||
|
||||
A wrapper around the provider to handle `onChange` events, because the editor is a mutable singleton so it won't ever register as "changed" otherwise.
|
||||
|
||||
@@ -34,23 +34,23 @@ A wrapper around the provider to handle `onChange` events, because the editor is
|
||||
|
||||
React hooks for Slate editors
|
||||
|
||||
###### `useFocused`
|
||||
### `useFocused`
|
||||
|
||||
Get the current `focused` state of the editor.
|
||||
|
||||
###### `useReadOnly`
|
||||
### `useReadOnly`
|
||||
|
||||
Get the current `readOnly` state of the editor.
|
||||
|
||||
###### `useSelected`
|
||||
### `useSelected`
|
||||
|
||||
Get the current `selected` state of an element.
|
||||
|
||||
###### `useSlate`
|
||||
### `useSlate`
|
||||
|
||||
Get the current editor object from the React context. Re-renders the context whenever changes occur in the editor.
|
||||
|
||||
###### `useSlateStatic`
|
||||
### `useSlateStatic`
|
||||
|
||||
Get the current editor object from the React context. A version of useSlate that does not re-render the context. Previously called `useEditor`.
|
||||
|
||||
@@ -58,71 +58,71 @@ Get the current editor object from the React context. A version of useSlate that
|
||||
|
||||
A React and DOM-specific version of the `Editor` interface. All about translating between the DOM and Slate.
|
||||
|
||||
###### `findKey(editor: ReactEditor, node: Node)`
|
||||
### `findKey(editor: ReactEditor, node: Node)`
|
||||
|
||||
Find a key for a Slate node.
|
||||
|
||||
###### `findPath(editor: ReactEditor, node: Node)`
|
||||
### `findPath(editor: ReactEditor, node: Node)`
|
||||
|
||||
Find the path of Slate node.
|
||||
|
||||
###### `isFocused(editor: ReactEditor)`
|
||||
### `isFocused(editor: ReactEditor)`
|
||||
|
||||
Check if the editor is focused.
|
||||
|
||||
###### `isReadOnly(editor: ReactEditor)`
|
||||
### `isReadOnly(editor: ReactEditor)`
|
||||
|
||||
Check if the editor is in read-only mode.
|
||||
|
||||
###### `blur(editor: ReactEditor)`
|
||||
### `blur(editor: ReactEditor)`
|
||||
|
||||
Blur the editor.
|
||||
|
||||
###### `focus(editor: ReactEditor)`
|
||||
### `focus(editor: ReactEditor)`
|
||||
|
||||
Focus the editor.
|
||||
|
||||
###### `deselect(editor: ReactEditor)`
|
||||
### `deselect(editor: ReactEditor)`
|
||||
|
||||
Deselect the editor.
|
||||
|
||||
###### `hasDOMNode(editor: ReactEditor, target: DOMNode, options: { editable?: boolean } = {})`
|
||||
### `hasDOMNode(editor: ReactEditor, target: DOMNode, options: { editable?: boolean } = {})`
|
||||
|
||||
Check if a DOM node is within the editor.
|
||||
|
||||
###### `insertData(editor: ReactEditor, data: DataTransfer)`
|
||||
### `insertData(editor: ReactEditor, data: DataTransfer)`
|
||||
|
||||
Insert data from a `DataTransfer` into the editor.
|
||||
|
||||
###### `setFragmentData(editor: ReactEditor, data: DataTransfer)`
|
||||
### `setFragmentData(editor: ReactEditor, data: DataTransfer)`
|
||||
|
||||
Sets data from the currently selected fragment on a `DataTransfer`.
|
||||
|
||||
###### `toDOMNode(editor: ReactEditor, node: Node)`
|
||||
### `toDOMNode(editor: ReactEditor, node: Node)`
|
||||
|
||||
Find the native DOM element from a Slate node.
|
||||
|
||||
###### `toDOMPoint(editor: ReactEditor, point: Point)`
|
||||
### `toDOMPoint(editor: ReactEditor, point: Point)`
|
||||
|
||||
Find a native DOM selection point from a Slate point.
|
||||
|
||||
###### `toDOMRange(editor: ReactEditor, range: Range)`
|
||||
### `toDOMRange(editor: ReactEditor, range: Range)`
|
||||
|
||||
Find a native DOM range from a Slate `range`.
|
||||
|
||||
###### `toSlateNode(editor: ReactEditor, domNode: DOMNode)`
|
||||
### `toSlateNode(editor: ReactEditor, domNode: DOMNode)`
|
||||
|
||||
Find a Slate node from a native DOM `element`.
|
||||
|
||||
###### `findEventRange(editor: ReactEditor, event: any)`
|
||||
### `findEventRange(editor: ReactEditor, event: any)`
|
||||
|
||||
Get the target range from a DOM `event`.
|
||||
|
||||
###### `toSlatePoint(editor: ReactEditor, domPoint: DOMPoint)`
|
||||
### `toSlatePoint(editor: ReactEditor, domPoint: DOMPoint)`
|
||||
|
||||
Find a Slate point from a DOM selection's `domNode` and `domOffset`.
|
||||
|
||||
###### `toSlateRange(editor: ReactEditor, domRange: DOMRange | DOMStaticRange | DOMSelection)`
|
||||
### `toSlateRange(editor: ReactEditor, domRange: DOMRange | DOMStaticRange | DOMSelection)`
|
||||
|
||||
Find a Slate range from a DOM range or selection.
|
||||
|
||||
@@ -130,10 +130,11 @@ Find a Slate range from a DOM range or selection.
|
||||
|
||||
React-specific plugins for Slate editors
|
||||
|
||||
###### `withReact(editor: Editor)`
|
||||
### `withReact(editor: Editor)`
|
||||
|
||||
Adds React and DOM specific behaviors to the editor.
|
||||
|
||||
## Utils
|
||||
|
||||
Private convenience modules
|
||||
|
||||
|
Reference in New Issue
Block a user