slate-schema-violations
import {
CHILD_OBJECT_INVALID,
CHILD_REQUIRED,
CHILD_TYPE_INVALID,
CHILD_UNKNOWN,
FIRST_CHILD_OBJECT_INVALID,
FIRST_CHILD_TYPE_INVALID,
LAST_CHILD_OBJECT_INVALID,
LAST_CHILD_TYPE_INVALID,
NODE_DATA_INVALID,
NODE_IS_VOID_INVALID,
NODE_MARK_INVALID,
NODE_TEXT_INVALID,
PARENT_OBJECT_INVALID,
PARENT_TYPE_INVALID,
} from 'slate-schema-violations'A set of constants for the built-in violations in a Slate schema.
Example
import React from 'react'
import Types from 'slate-prop-types'
class Toolbar extends React.Component {
propTypes = {
block: Types.block,
schema: Types.schema.isRequired,
value: Types.value.isRequired,
}
...
}Exports
CHILD_OBJECT_INVALID
CHILD_OBJECT_INVALIDRaised when the object property of a child node is invalid.
CHILD_REQUIRED
CHILD_REQUIREDRaised when a child node was required but none was found.
CHILD_TYPE_INVALID
CHILD_TYPE_INVALIDRaised when the type property of a child node is invalid.
CHILD_UNKNOWN
CHILD_UNKNOWNRaised when a child was not expected but one was found.
FIRST_CHILD_OBJECT_INVALID
FIRST_CHILD_OBJECT_INVALIDRaised when the object property of the first child node is invalid, when a specific first rule was defined in a schema.
FIRST_CHILD_TYPE_INVALID
FIRST_CHILD_TYPE_INVALIDRaised when the type property of the first child node is invalid, when a specific first rule was defined in a schema.
LAST_CHILD_OBJECT_INVALID
LAST_CHILD_OBJECT_INVALIDRaised when the object property of the last child node is invalid, when a specific last rule was defined in a schema.
LAST_CHILD_TYPE_INVALID
LAST_CHILD_TYPE_INVALIDRaised when the type property of the last child node is invalid, when a specific last rule was defined in a schema.
NODE_DATA_INVALID
NODE_DATA_INVALIDRaised when the data property of a node contains an invalid entry.
NODE_IS_VOID_INVALID
NODE_IS_VOID_INVALIDRaised when the isVoid property of a node is invalid.
NODE_MARK_INVALID
NODE_MARK_INVALIDRaised when one of the marks in a node is invalid.
NODE_TEXT_INVALID
NODE_TEXT_INVALIDRaised when the text content of a node is invalid.
PARENT_OBJECT_INVALID
PARENT_OBJECT_INVALIDRaised when the object property of the parent of a node is invalid, when a specific parent rule was defined in a schema.
PARENT_TYPE_INVALID
PARENT_TYPE_INVALIDRaised when the type property of the parent of a node is invalid, when a specific parent rule was defined in a schema.
Last updated