0.1.0-alpha.12 • Published 1 year ago

@react-page-plugins/slate-table v0.1.0-alpha.12

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@react-page-plugins/slate-table

ReactPage plugin for slate table

Installation

$ npm install @react-page-plugins/slate-table
$ yarn add @react-page-plugins/slate-table

Usage

import React, { useState } from 'react';
import Editor, { ValueWithLegacy } from '@react-page/editor';
import table from '@react-page-plugins/slate-table';

import '@react-page/editor/lib/index.css';
import '@react-page-plugins/slate-table/lib/index.css';
import 'rc-slider/assets/index.css';

const cellPlugins = [table()];

export default function ExamplePage() {
  const [value, setValue] = useState<ValueWithLegacy>({} as ValueWithLegacy);

  const handleChange = (val: any) => {
    setValue(val);
  };

  return (
    <Editor cellPlugins={cellPlugins} value={value} onChange={handleChange} />
  );
}