1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-01-17 21:49:20 +01:00

add docs, update readme

This commit is contained in:
Ian Storm Taylor 2016-07-06 17:14:48 -07:00
parent 64cd2b6c7f
commit cf929f026b
2 changed files with 45 additions and 1 deletions

View File

@ -58,7 +58,7 @@ If you're using Slate for the first time, check out the [Getting Started](./docs
- Customizing Slate's Behavior
- Adding Plugins
- **Core Concepts**
- [**Core Concepts**](docs/concepts.md)
- Statelessness & Immutability
- [The Document Model](docs/getting-started.md#the-document-model)
- The Selection Model

44
docs/concepts.md Normal file
View File

@ -0,0 +1,44 @@
This document explain the core concepts that Slate is built on around. It is helpful to read it through in it's entirety to get a good mental model for how Slate works.
- [Statelessness & Immutability](#statelessness-immutability)
- [The Document Model](#the-document-model)
- [The Selection Mode](#the-selection-model)
- [Transforms](#transforms)
- [Plugins](#plugins)
### Statelessness & Immutability
- all the data is immutable, for performance
- changes propagated up through the single `onChange` handler
### The Document Model
- recursive, nested tree
- document, blocks, and inlines implement node interface
- blocks and inlines can be nested to any depth
- blocks contain inlines and text
- inlines contain text
- always a text node at the leaves, for selection handling
- void nodes can't have content, but still have an empty text node
### The Selection Model
- selection is always relative to text nodes (is normalized)
- "blocks" always refers to the closest block parent
### Transforms
- no updating of document/selection outside of transforms
- wrap blocks wraps close to the text
- wrap inline wraps far from the text
### Plugins
- everything is a plugin, even core is one
- the editor's props become the highest-priority plugin