1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-19 05:31:56 +02:00

Clarifies when to use Editor.insertNode vs. Transforms.insertNodes (#4731)

This commit is contained in:
Doug Reeder
2021-12-18 09:05:10 -05:00
committed by GitHub
parent 65708358bb
commit 228cee56a1
2 changed files with 16 additions and 6 deletions

View File

@@ -276,19 +276,19 @@ Insert a block break at the current selection.
#### `Editor.insertFragment(editor: Editor, fragment: Node[]) => void`
Insert a fragment at the current selection.
Inserts a fragment _at the current selection_.
If the selection is currently expanded, it will be deleted first.
If the selection is currently expanded, it will be deleted first. To atomically insert nodes (including at the very beginning or end), use [Transforms.insertNodes](../transforms.md#transformsinsertnodeseditor-editor-nodes-node--node-options).
#### `Editor.insertNode(editor: Editor, node: Node) => void`
Insert a node at the current selection.
Inserts a node _at the current selection_.
If the selection is currently expanded, it will be deleted first.
If the selection is currently expanded, it will be deleted first. To atomically insert a node (including at the very beginning or end), use [Transforms.insertNodes](../transforms.md#transformsinsertnodeseditor-editor-nodes-node--node-options).
#### `Editor.insertText(editor: Editor, text: string) => void`
Insert text at the current selection.
Inserts text _at the current selection_.
If the selection is currently expanded, it will be deleted first.