1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-04-20 05:11:53 +02:00

add utils reference

This commit is contained in:
Ian Storm Taylor 2016-11-28 10:50:34 -08:00
parent 919d4b5a3a
commit d925940b0d
4 changed files with 28 additions and 0 deletions

View File

@ -47,6 +47,11 @@
- [Core](./reference/plugins/core.md)
## Utils Reference
- [Utils](./reference/utils/utils.md)
## General
- [FAQ](./general/faq.md)

View File

@ -25,3 +25,5 @@ This is the full reference documentation for all of the pieces of Slate, broken
- **Plugins**
- [Plugins](./plugins/plugin.md)
- [Core](./plugins/core.md)
- **Utils**
- [Utils](./utils/utils.md)

View File

@ -39,6 +39,15 @@
## 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`
`Immutable.List`

View 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.