1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-30 18:39:51 +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:
Doug Reeder
2021-11-16 04:20:43 -05:00
committed by GitHub
parent 5dc9dc5227
commit 7d9d25e179
20 changed files with 69 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
# Location Types
# Location Types APIs
The `Location` interface is a union of the ways to refer to a specific location in a Slate document: paths, points or ranges. Methods will often accept a `Location` instead of requiring only a `Path`, `Point` or `Range`.

View File

@@ -1,4 +1,4 @@
# Location
# Location API
The Location interface is a union of the ways to refer to a specific location in a Slate document: paths, points or ranges. Methods will often accept a Location instead of requiring only a Path, Point or Range.

View File

@@ -1,4 +1,4 @@
# Path
# Path API
`Path` arrays are a list of indexes that describe a node's exact position in a Slate node tree. Although they are usually relative to the root `Editor` object, they can be relative to any `Node` object.

View File

@@ -1,4 +1,4 @@
# PointEntry
# PointEntry API
`PointEntry` objects are returned when iterating over `Point` objects that belong to a range.

View File

@@ -1,4 +1,4 @@
# PointRef
# PointRef API
`PointRef` objects keep a specific point in a document synced over time as new operations are applied to the editor. You can access their property `current` at any time for the up-to-date `Point` value.

View File

@@ -1,6 +1,6 @@
# Point
# Point API
`Point` objects refer to a specific location in a text node in a Slate document. Its `path` refers to the location of the node in the tree, and its offset refers to distance into the node's string of text. Points may only refer to `Text` nodes.
`Point` objects refer to a specific location in a text node in a Slate document. Its `path` refers to the location of the node in the tree, and its `offset` refers to distance into the node's string of text. Points may only refer to `Text` nodes.
```typescript
interface Point {

View File

@@ -1,4 +1,4 @@
# RangeRef
# RangeRef API
`RangeRef` objects keep a specific range in a document synced over time as new operations are applied to the editor. You can access their property `current` at any time for the up-to-date `Range` value.

View File

@@ -1,4 +1,4 @@
# Range
# Range API
`Range` objects are a set of points that refer to a specific span of a Slate document. They can define a span inside a single node or they can span across multiple nodes. The editor's `selection` is stored as a range.

View File

@@ -1,6 +1,6 @@
# Span
# Span API
A `Span` is a low-level way to refer to a range using `Element` as the end points instead of a `Point` which requires the use of leaf text nodes.
A `Span` is a low-level way to refer to a `Range` using `Element` as the end points instead of a `Point` which requires the use of leaf text nodes.
```typescript
type Span = [Path, Path]