@artibox/slate-editor

<div align="center"> <img src="https://raw.githubusercontent.com/ianstormtaylor/slate/master/docs/images/banner.png" height="200" /> </div>

Usage no npm install needed!

<script type="module">
  import artiboxSlateEditor from 'https://cdn.skypack.dev/@artibox/slate-editor';
</script>

README

@artibox/slate-editor

Slate editor.

npm package npm downloads

Installation

npm install @artibox/slate-editor --save

or

$ yarn add @artibox/slate-editor

Usage

import React from 'react';
import { createArtiboxEditor } from '@artibox/slate-editor';

const initialValue = ...;// from slate

const plugins = [
  // ...
];

const ArtiboxEditor = createArtiboxEditor({
  plugins
});

const YourEditor = () => {
  const [value, setValue] = useState(initialValue);
  const onChange = useCallback(change => setValue(change.value), []);

  return (
    <ArtiboxEditor
      value={value}
      onChange={onChange}
    />
  );
}

API