mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-11 01:33:58 +02:00
Add getFragment to the API docs
This commit is contained in:
@@ -369,16 +369,22 @@ Check if a value is a void `Element` object.
|
|||||||
|
|
||||||
Called when there is a change in the editor.
|
Called when there is a change in the editor.
|
||||||
|
|
||||||
### Override mark methods
|
### Mark methods
|
||||||
|
|
||||||
#### `addMark(key: string, value: any)`
|
#### `addMark(key: string, value: any)`
|
||||||
|
|
||||||
Add a custom property to the leaf text nodes in the current selection. If the selection is currently collapsed, the marks will be added to the `editor.marks` property instead, and applied when text is inserted next.
|
Add a custom property to the leaf text nodes in the currentk selection. If the selection is currently collapsed, the marks will be added to the `editor.marks` property instead, and applied when text is inserted next.
|
||||||
|
|
||||||
#### `removeMark(key: string)`
|
#### `removeMark(key: string)`
|
||||||
|
|
||||||
Remove a custom property from the leaf text nodes in the current selection.
|
Remove a custom property from the leaf text nodes in the current selection.
|
||||||
|
|
||||||
|
### getFragment method
|
||||||
|
|
||||||
|
#### `getFragment(): Descendant`
|
||||||
|
|
||||||
|
Returns the fragment at the current selection. Used when cutting or copying, as an example, to get the fragment at the current selection.
|
||||||
|
|
||||||
### Delete methods
|
### Delete methods
|
||||||
|
|
||||||
When a user presses backspace or delete, it invokes the method based on the selection. For example, if the selection is expanded over some text and the user presses the backspace key, `deleteFragment` will be called but if the selecttion is collapsed, `deleteBackward` will be called.
|
When a user presses backspace or delete, it invokes the method based on the selection. For example, if the selection is expanded over some text and the user presses the backspace key, `deleteFragment` will be called but if the selecttion is collapsed, `deleteBackward` will be called.
|
||||||
|
Reference in New Issue
Block a user