How to use the slate-prop-types.state function in slate-prop-types

To help you get started, we’ve selected a few slate-prop-types examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ianstormtaylor / slate / packages / slate-react / src / components / placeholder.js View on Github external
class Placeholder extends React.Component {

  /**
   * Property types.
   *
   * @type {Object}
   */

  static propTypes = {
    children: Types.any.isRequired,
    className: Types.string,
    firstOnly: Types.bool,
    node: SlateTypes.node.isRequired,
    parent: SlateTypes.node,
    state: SlateTypes.state.isRequired,
    style: Types.object,
  }

  /**
   * Default properties.
   *
   * @type {Object}
   */

  static defaultProps = {
    firstOnly: true,
  }

  /**
   * Should the placeholder update?
   *
github ianstormtaylor / slate / packages / slate-react / src / components / default-placeholder.js View on Github external
class DefaultPlaceholder extends React.Component {

  /**
   * Property types.
   *
   * @type {Object}
   */

  static propTypes = {
    editor: Types.object.isRequired,
    isSelected: Types.bool.isRequired,
    node: SlateTypes.node.isRequired,
    parent: SlateTypes.node.isRequired,
    readOnly: Types.bool.isRequired,
    state: SlateTypes.state.isRequired,
  }

  /**
   * Render.
   *
   * @return {Element}
   */

  render() {
    const { editor, state } = this.props
    if (!editor.props.placeholder) return null
    if (state.document.getBlocks().size > 1) return null

    const style = {
      pointerEvents: 'none',
      display: 'inline-block',

slate-prop-types

A set of React prop type checkers for Slate editors.

MIT
Latest version published 4 years ago

Package Health Score

72 / 100
Full package analysis