How to use the slate-react.withReact 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 edtr-io / edtr-io / packages / plugins / text / src / editor.tsx View on Github external
function createEditor(plugins: TextConfig['plugins']): Editor {
  let editor = withEdtr(withReact(createSlateEditor()))
  plugins.forEach(withPlugin => {
    editor = withPlugin(editor)
  })
  return editor

  function withEdtr(editor: T): T & Editor {
    const e = editor as T & Editor
    e.controls = []
    e.onKeyDown = () => {}
    e.renderEditable = ({ children }) => {
      return children
    }
    // eslint-disable-next-line react/display-name
    e.renderElement = ({ attributes, children }) => {
      return <div>{children}</div>
    }
github ianstormtaylor / slate / site / examples / hovering-toolbar.js View on Github external
  const editor = useMemo(() => withHistory(withReact(createEditor())), [])
github ianstormtaylor / slate / site / examples / read-only.js View on Github external
  const editor = useMemo(() => withReact(createEditor()), [])
  return (
github ianstormtaylor / slate / site / examples / plaintext.js View on Github external
  const editor = useMemo(() => withHistory(withReact(createEditor())), [])
  return (
github ianstormtaylor / slate / site / examples / markdown-preview.js View on Github external
  const editor = useMemo(() => withHistory(withReact(createEditor())), [])
  const decorate = useCallback(([node, path]) => {
github ianstormtaylor / slate / site / examples / huge-document.js View on Github external
  const editor = useMemo(() => withReact(createEditor()), [])
  return (
github ianstormtaylor / slate / site / examples / images.js View on Github external
    () => withImages(withHistory(withReact(createEditor()))),
    []
github ianstormtaylor / slate / site / examples / paste-html.js View on Github external
    () => withHtml(withReact(withHistory(createEditor()))),
    []
github ianstormtaylor / slate / site / examples / links.js View on Github external
    () => withLinks(withHistory(withReact(createEditor()))),
    []
github ianstormtaylor / slate / site / examples / mentions.js View on Github external
    () => withMentions(withReact(withHistory(createEditor()))),
    []