mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-13 02:34:05 +02:00
add utils reference
This commit is contained in:
@@ -47,6 +47,11 @@
|
|||||||
- [Core](./reference/plugins/core.md)
|
- [Core](./reference/plugins/core.md)
|
||||||
|
|
||||||
|
|
||||||
|
## Utils Reference
|
||||||
|
|
||||||
|
- [Utils](./reference/utils/utils.md)
|
||||||
|
|
||||||
|
|
||||||
## General
|
## General
|
||||||
|
|
||||||
- [FAQ](./general/faq.md)
|
- [FAQ](./general/faq.md)
|
||||||
|
@@ -25,3 +25,5 @@ This is the full reference documentation for all of the pieces of Slate, broken
|
|||||||
- **Plugins**
|
- **Plugins**
|
||||||
- [Plugins](./plugins/plugin.md)
|
- [Plugins](./plugins/plugin.md)
|
||||||
- [Core](./plugins/core.md)
|
- [Core](./plugins/core.md)
|
||||||
|
- **Utils**
|
||||||
|
- [Utils](./utils/utils.md)
|
||||||
|
@@ -39,6 +39,15 @@
|
|||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
|
### `key`
|
||||||
|
`String`
|
||||||
|
|
||||||
|
A short-lived, unique identifier for the node.
|
||||||
|
|
||||||
|
By default, keys are not meant to be long-lived unique identifiers for nodes that you might store in a database, or elsewhere. They are meant purely to identify a node inside of a single Slate instance. For that reason, they are simply auto-incrementing strings. (eg. `'0'`, `'1'`, `'2'`, ...)
|
||||||
|
|
||||||
|
If you want to make your keys uniqueness long-lived, you'll need to supply your own key generating function via the [`setKeyGenerator`](../utils/utils.md#setkeygenerator) util.
|
||||||
|
|
||||||
### `nodes`
|
### `nodes`
|
||||||
`Immutable.List`
|
`Immutable.List`
|
||||||
|
|
||||||
|
12
docs/reference/utils/utils.md
Normal file
12
docs/reference/utils/utils.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
# Utils
|
||||||
|
|
||||||
|
These are extra utility functions that ship with Slate that may be useful for certain use cases.
|
||||||
|
|
||||||
|
|
||||||
|
## `setKeyGenerator`
|
||||||
|
`setKeyGenerator(generator: Function) => Void`
|
||||||
|
|
||||||
|
Allows you to specify your own key generating function, instead of using Slate's built-in default generator which simply uses auto-incrementing number strings. (eg. `'0'`, `'1'`, `'2'`, ...)
|
||||||
|
|
||||||
|
This will act globally on all uses of the Slate dependency.
|
Reference in New Issue
Block a user