mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-19 13:41:19 +02:00
Rename "state" to "value" everywhere (#1313)
* rename state to value in slate core, as deprecation * rename all references to state to value in slate core * migrate slate-base64-serializer * migrate slate-html-serializer * migrate slate-hyperscript * migrate slate-plain-serializer * migrate slate-prop-types * migrate slate-simulator * fix change.setState compat * deprecate references to state in slate-react * remove all references to state in slate-react * remove `value` and `schema` from props to all components * fix default renderPlaceholder * fix tests * update examples * update walkthroughs * update guides * update reference
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
|
||||
import isEmpty from 'is-empty'
|
||||
import isPlainObject from 'is-plain-object'
|
||||
import logger from 'slate-dev-logger'
|
||||
|
||||
import {
|
||||
Block,
|
||||
@@ -9,8 +10,8 @@ import {
|
||||
Mark,
|
||||
Node,
|
||||
Range,
|
||||
State,
|
||||
Text
|
||||
Text,
|
||||
Value,
|
||||
} from 'slate'
|
||||
|
||||
/**
|
||||
@@ -74,7 +75,12 @@ const CREATORS = {
|
||||
return Range.create(attributes)
|
||||
},
|
||||
|
||||
state(tagName, attributes, children) {
|
||||
state(...args) {
|
||||
logger.deprecate('slate-hyperscript@0.3.0', 'The `<state>` tag has been renamed to `<value>`.')
|
||||
return CREATORS.value(...args)
|
||||
},
|
||||
|
||||
value(tagName, attributes, children) {
|
||||
const { data } = attributes
|
||||
const document = children.find(Document.isDocument)
|
||||
let selection = children.find(Range.isRange) || Range.create()
|
||||
@@ -110,8 +116,8 @@ const CREATORS = {
|
||||
selection = selection.merge(props).normalize(document)
|
||||
}
|
||||
|
||||
const state = State.create({ data, document, selection })
|
||||
return state
|
||||
const value = Value.create({ data, document, selection })
|
||||
return value
|
||||
},
|
||||
|
||||
text(tagName, attributes, children) {
|
||||
|
Reference in New Issue
Block a user