mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-17 20:51:20 +02:00
Adds clarification & examples to demystify Transforms. (#4653)
* Adds clarification & examples to demystify Transforms. * Fleshes out documentation of NodeOptions for Transforms * Update docs/concepts/04-transforms.md Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org> * Uses 'API' in the title of all API documents Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Node Types
|
||||
# Node Types APIs
|
||||
|
||||
The `Node` union type represents all of the different types of nodes that occur in a Slate document tree.
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# Editor
|
||||
# Editor API
|
||||
|
||||
The `Editor` object stores all the state of a slate editor. It can be extended by plugins to add helpers and implement new behaviors.
|
||||
The `Editor` object stores all the state of a Slate editor. It can be extended by [plugins](../../concepts/08-plugins.md) to add helpers and implement new behaviors. It's a type of `Node` and its path is `[]`.
|
||||
|
||||
```typescript
|
||||
interface Editor {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# Element
|
||||
# Element API
|
||||
|
||||
`Element` objects are a type of node in a Slate document that contain other `Element` nodes or `Text` nodes.
|
||||
`Element` objects are a type of `Node` in a Slate document that contain other `Element` nodes or `Text` nodes.
|
||||
|
||||
```typescript
|
||||
interface Element {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# NodeEntry
|
||||
# NodeEntry API
|
||||
|
||||
`NodeEntry` objects are returned when iterating over the nodes in a Slate document tree. They consist of the node and its `Path` relative to the root node in the document.
|
||||
`NodeEntry` objects are returned when iterating over the nodes in a Slate document tree. They consist of an array with two elements: the `Node` and its `Path` relative to the root node in the document.
|
||||
|
||||
They are generics meaning that sometimes they will return a subset of `Node` types like an `Element` or `Text`.
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Node
|
||||
# Node API
|
||||
|
||||
- [Static methods](node.md#static-methods)
|
||||
- [Retrieval methods](node.md#retrieval-methods)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Text
|
||||
# Text API
|
||||
|
||||
`Text` objects represent the nodes that contain the actual text content of a Slate document along with any formatting properties. They are always leaf nodes in the document tree as they cannot contain any children.
|
||||
|
||||
|
Reference in New Issue
Block a user