1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-11 17:53:59 +02:00

Consistent insert* methods (#5415)

* feat: add reviewpad.yml file

* Update reviewpad.yml

*  options to `Editor.insert*`

* 📝 options to `Editor.insert*`

*  getDefaultInsertLocation

*  getDefaultInsertLocation

*  getDefaultInsertLocation

* 📝 consistent selection

* Create tasty-lizards-remain.md

* Update tasty-lizards-remain.md

---------

Co-authored-by: reviewpad[bot] <104832597+reviewpad[bot]@users.noreply.github.com>
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
This commit is contained in:
Ziad Beyens
2023-05-07 00:41:42 +02:00
committed by GitHub
parent 48c18b5368
commit 01f0210bcc
12 changed files with 92 additions and 60 deletions

View File

@@ -246,23 +246,23 @@ Delete the content in the current selection.
Insert a block break at the current selection.
#### `Editor.insertFragment(editor: Editor, fragment: Node[]) => void`
#### `Editor.insertFragment(editor: Editor, fragment: Node[], options?) => void`
Inserts a fragment _at the current selection_.
Inserts a fragment at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
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).
Options: `{at?: Location, hanging?: boolean, voids?: boolean}`
#### `Editor.insertNode(editor: Editor, node: Node) => void`
#### `Editor.insertNode(editor: Editor, node: Node, options?) => void`
Inserts a node _at the current selection_.
Atomically insert `node` at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
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).
Options supported: `NodeOptions & {hanging?: boolean, select?: boolean}`.
#### `Editor.insertText(editor: Editor, text: string) => void`
#### `Editor.insertText(editor: Editor, text: string, options?) => void`
Inserts text _at the current selection_.
Insert a string of text at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
If the selection is currently expanded, it will be deleted first.
Options: `{at?: Location, voids?: boolean}`
#### `Editor.removeMark(editor: Editor, key: string) => void`

View File

@@ -38,13 +38,13 @@ Transforms that operate on nodes.
#### `Transforms.insertFragment(editor: Editor, fragment: Node[], options?)`
Insert of fragment of nodes at the specified location in the document. If no location is specified, insert at the current selection.
Insert of fragment of nodes at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
Options: `{at?: Location, hanging?: boolean, voids?: boolean}`
#### `Transforms.insertNodes(editor: Editor, nodes: Node | Node[], options?)`
Atomically inserts `nodes` at the specified location in the document. If no location is specified, inserts at the current selection. If there is no selection, inserts at the end of the document.
Atomically inserts `nodes` at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
Options supported: `NodeOptions & {hanging?: boolean, select?: boolean}`.
@@ -170,7 +170,7 @@ Options: `{at?: Location, distance?: number, unit?: 'character' | 'word' | 'line
#### `Transforms.insertText(editor: Editor, text: string, options?)`
Insert a string of text at the specified location in the document. If no location is specified, insert at the current selection.
Insert a string of text at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
Options: `{at?: Location, voids?: boolean}`