1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-07-31 04:20:26 +02:00

fix examples

This commit is contained in:
Ian Storm Taylor
2016-06-23 23:59:22 -07:00
parent 9d62948b1a
commit 69d2a55d33
4 changed files with 20 additions and 28 deletions

View File

@@ -12,21 +12,17 @@ import state from './state.json'
*/
function deserialize(string) {
const characters = string
.split('')
.reduce((list, char) => {
return list.push(Character.create({ text: char }))
}, Character.createList())
const text = Text.create({ characters })
const texts = Block.createMap([text])
const node = Block.create({
type: 'paragraph',
nodes: texts,
const characters = string.split('').map(char => {
return { text: char }
})
const nodes = Block.createMap([node])
const document = Document.create({ nodes })
const text = Text.create({ characters })
const block = Block.create({
type: 'paragraph',
nodes: [text]
})
const document = Document.create({ nodes: [block] })
const state = State.create({ document })
return state
}