1.2.0 • Published 4 years ago

@artibox/slate-editor v1.2.0

Weekly downloads
15
License
MIT
Repository
github
Last release
4 years ago

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