How to use the slate-react.Editor function in slate-react

To help you get started, we’ve selected a few slate-react 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 olymp / olymp / external / slate / slate-writer.js View on Github external
return _this.ref.focus();
        },
        ref: function ref(r) {
          return _this.ref = r;
        },
        spellcheck: spellcheck || false,
        readOnly: false,
        onDrop: _this.onDrop,
        onPaste: _this.onPaste,
        plugins: readOnly ? emptyArray : plugins,
        onChange: _this.onChange,
        onKeyDown: _this.onKeyDown,
        placeholder: !readOnly && 'Hier Text eingeben...',
        placeholderStyle: { padding: '0 1rem', opacity: 0.33 },
        style: _extends({ height: '100%' }, style)
      })) : _react2.default.createElement(_slateReact.Editor, _extends({}, rest, {
        value: value,
        className: 'slate-editor slate-writer',
        onDragEnter: function onDragEnter(e) {
          return _this.ref.focus();
        },
        ref: function ref(r) {
          return _this.ref = r;
        },
        spellcheck: spellcheck || false,
        readOnly: false,
        onDrop: _this.onDrop,
        onPaste: _this.onPaste,
        plugins: readOnly ? emptyArray : plugins,
        onChange: _this.onChange,
        onKeyDown: _this.onKeyDown,
        placeholder: !readOnly && 'Hier Text eingeben...',
github olymp / olymp / external / slate / slate-reader.js View on Github external
var Reader = function Reader(_ref3) {
  var children = _ref3.children,
      schema = _ref3.schema,
      renderNode = _ref3.renderNode,
      className = _ref3.className,
      style = _ref3.style,
      value = _ref3.value,
      rest = _objectWithoutProperties(_ref3, ['children', 'schema', 'renderNode', 'className', 'style', 'value']);

  return _react2.default.createElement(
    'div',
    { className: className, style: _extends({ position: 'relative' }, style) },
    children,
    _react2.default.createElement(_slateReact.Editor, _extends({}, rest, {
      className: 'slate-editor slate-reader',
      value: value || _slatePlainSerializer2.default.deserialize(''),
      spellcheck: false,
      readOnly: true,
      renderNode: renderNode,
      placeholderStyle: { padding: '0 1rem', opacity: 0.33 }
    }))
  );
};
github nossas / slate-editor / lib / slate-editor / SlateContent.js View on Github external
wrapperStyle = _ref.wrapperStyle,
      style = _ref.style,
      value = _ref.value,
      outerState = _ref.outerState,
      plugins = _ref.plugins,
      onChange = _ref.onChange,
      children = _ref.children,
      rest = _objectWithoutProperties(_ref, ['className', 'wrapperStyle', 'style', 'value', 'outerState', 'plugins', 'onChange', 'children']);

  var readOnly = outerState.readOnly;


  return _react2.default.createElement(
    'div',
    { className: (0, _classnames2.default)('editor--content', className), style: wrapperStyle },
    _react2.default.createElement(_slateReact.Editor, _extends({
      plugins: plugins,
      value: value,
      onChange: onChange,
      readOnly: readOnly,
      outerState: outerState,
      style: style,
      renderNode: renderNode,
      renderMark: renderMark
    }, rest)),
    children
  );
};
github olymp / olymp / external / slate / pug / editor.js View on Github external
className = _this$props.className,
          spellcheck = _this$props.spellcheck,
          _this$props$schema = _this$props.schema,
          schema = _this$props$schema === undefined ? {} : _this$props$schema,
          renderNode = _this$props.renderNode,
          _this$props$style = _this$props.style,
          style = _this$props$style === undefined ? {} : _this$props$style,
          full = _this$props.full,
          isCode = _this$props.isCode,
          setIsCode = _this$props.setIsCode,
          setFull = _this$props.setFull,
          isFull = _this$props.isFull,
          setIsFull = _this$props.setIsFull,
          rest = _objectWithoutProperties(_this$props, ['children', 'readOnly', 'className', 'spellcheck', 'schema', 'renderNode', 'style', 'full', 'isCode', 'setIsCode', 'setFull', 'isFull', 'setIsFull']);

      return _react2.default.createElement(_slateReact.Editor, _extends({}, rest, {
        className: 'slate-editor slate-writer',
        spellcheck: spellcheck || false,
        readOnly: false,
        onDrop: _this.onDrop,
        onPaste: _this.onPaste,
        renderNode: renderNode,
        onChange: _this.onChange,
        onKeyDown: _this.onKeyDown,
        placeholder: !readOnly && 'Hier Text eingeben...',
        placeholderStyle: { padding: '0 1rem', opacity: 0.33 },
        style: _extends({ height: '100%' }, style)
      }));
    }, _temp), _possibleConstructorReturn(_this, _ret);
  }