0.1.0 • Published 4 years ago

kothing-editor-react v0.1.0

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

Kothing-Editor-React

This package is a thin wrapper around Kothing-Editor to make it easier to use in a React application.

Usage

import React from 'react';
import ReactEditor from 'kothing-editor-react';

const Editor = () => {
  // setContent
  const handleSetContent = () => {
    // Return the content to be set
    return 'demo';
  };

  // onChange
  const onChange = (d: any) => {
    console.log('change:', d);
  };

  return (
    <ReactEditor
      width="100%"
      height="300px"
      toolBarItem={[
        ['undo', 'redo', 'removeFormat'],
        ['font', 'fontSize', 'formatBlock'],
        ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript', 'fontColor', 'hiliteColor'],
        [
          'outdent',
          'indent',
          'align',
          'horizontalRule',
          'list',
          'table',
          'link',
          'image',
          'video',
          'fullScreen',
          'showBlocks',
          'codeView',
          'preview',
          'print',
          'save',
        ],
      ]}
      lang="en"
      onChange={onChange}
      setContents={handleSetContent()}
    />
  );
};

export default Editor;
0.1.0

4 years ago