1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-30 10:29:48 +02:00

add linting to examples

This commit is contained in:
Ian Storm Taylor
2016-07-07 08:35:13 -07:00
parent 226b6592dc
commit db1151bd15
12 changed files with 429 additions and 290 deletions

View File

@@ -1,7 +1,7 @@
import { Block, Character, Document, Editor, State, Text } from '../..'
import React from 'react'
import state from './state.json'
import initialState from './state.json'
/**
* A helper to deserialize a string into an editor state.
@@ -54,7 +54,7 @@ class PlainText extends React.Component {
*/
state = {
state: deserialize(state)
state: deserialize(initialState)
};
/**
@@ -63,22 +63,30 @@ class PlainText extends React.Component {
* @return {Component} component
*/
render() {
render = () => {
return (
<Editor
state={this.state.state}
onChange={(state) => {
console.groupCollapsed('Change!')
console.log('Document:', state.document.toJS())
console.log('Selection:', state.selection.toJS())
console.log('Content:', serialize(state))
console.groupEnd()
this.setState({ state })
}}
onChange={this.onChange}
/>
)
}
/**
* On change.
*
* @param {State} state
*/
onChange = (state) => {
console.groupCollapsed('Change!')
console.log('Document:', state.document.toJS())
console.log('Selection:', state.selection.toJS())
console.log('Content:', serialize(state))
console.groupEnd()
this.setState({ state })
}
}
/**