mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-01-19 06:18:16 +01:00
add plugins and serializers readmes
This commit is contained in:
parent
6a25bee4e4
commit
69f990cccb
2
lib/plugins/Readme.md
Normal file
2
lib/plugins/Readme.md
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
This directory contains the only plugin that ships with Slate by default, which controls all of the "core" logic. For example, it handles splitting apart paragraphs when `enter` is pressed, or inserting plain text content from the clipboard on paste.
|
23
lib/serializers/Readme.md
Normal file
23
lib/serializers/Readme.md
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
This directory contains the serializers that ship by default with Slate. They are not the only serializers, it's fairly easy to implement your own if you have more complex use cases. Here's what the core serializers do:
|
||||
|
||||
- [Html](#html)
|
||||
- [Raw](#raw)
|
||||
|
||||
#### Html
|
||||
|
||||
The `Html` serializer offers a simple way to serialize and deserialize an HTML schema of your choosing.
|
||||
|
||||
It doesn't hardcode any information about the schema itself (like which tag means "bold"), but allows you to build up a simple HTML serializer for your own use case.
|
||||
|
||||
It handles all of the heavy lifting of actually parsing the HTML, and iterating over the elements, and all you have to supply it is a `serialize()` and `deserialize()` function for each type of [`Node`](../models#node) or [`Mark`](../models/#mark) you want it to handle.
|
||||
|
||||
|
||||
#### Raw
|
||||
|
||||
The `Raw` serializer is the simplest serializer, which translates a [`State`](../models#state) into JSON.
|
||||
|
||||
It doesn't just use Immutable.js's [`.toJSON()`](https://facebook.github.io/immutable-js/docs/#/List/toJS) method. Instead, it performs a little bit of "minifying" logic to reduce unnecessary information from being in the raw output.
|
||||
|
||||
It also transforms [`Text`](../models#text) nodes's content from being organized by [`Characters`](../models#character) into the concept of "ranges", which have a unique set of [`Marks`](../models#mark).
|
||||
|
Loading…
x
Reference in New Issue
Block a user