mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-18 05:01:17 +02:00
update docs
This commit is contained in:
@@ -44,18 +44,18 @@ The change methods are the one place in Slate where overlap and near-duplication
|
||||
|
||||
There are a handful of different categories of changes that ship with Slate by default, and understanding them may help you understand which methods to reach for when trying to write your editor's logic...
|
||||
|
||||
### At a Specific Range
|
||||
|
||||
These are changes like `deleteAtRange()`, `addMarkAtArange()`, `unwrapBlockAtRange()`, etc. that take in a [`Range`](./range.md) argument and apply a change to the document for all of the content in that range. These aren't used that often, because you'll usually be able to get away with using the next category of changes instead...
|
||||
|
||||
### At the Current Selection
|
||||
|
||||
These are changes like `delete()`, `addMark()`, `insertBlock()`, etc. that are the same as the `*AtRange` equivalents, but don't need to take in a range argument, because they apply make their edits based on where the user's current selection is. These are often what you want to use when programmatically editing "like a user".
|
||||
|
||||
### On the Selection
|
||||
|
||||
These are changes like `blur()`, `collapseToStart()`, `moveToRangeOf()`, etc. that change the `state.selection` model and update the user's cursor without affecting the content of the document.
|
||||
|
||||
### On the Document at a Specific Range
|
||||
|
||||
These are changes like `deleteAtRange()`, `addMarkAtArange()`, `unwrapBlockAtRange()`, etc. that take in a [`Range`](./range.md) argument and apply a change to the document for all of the content in that range.
|
||||
|
||||
### On the Document at the Current Selection
|
||||
|
||||
These are changes like `delete()`, `addMark()`, `insertBlock()`, etc. that don't need to take in a range argument, because they apply make their edits based on where the user's current selection is. These are often what you want to use when programmatically editing "like a user".
|
||||
|
||||
### On a Specific Node
|
||||
|
||||
These are changes like `removeNodeByKey()`, `setNodeByKey()`, `removeMarkByKey()`, etc. that take a `key` string referring to a specific node, and then change that node in different ways. These are often what you use when making programmatic changes from inside your custom node components, where you already have a reference to `props.node.key`.
|
||||
|
Reference in New Issue
Block a user