0.3.2 • Published 2 days ago

kyz-editor v0.3.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 days ago

A library editor for simple react based on Lexical.js.

For example...

import { Editor, EditorState, initialState } from 'kyz-editor';

function Placeholder() {
  return <div className="editor-placeholder">Enter some rich text...</div>;
}

const App = () => {
  const [editorState, setEditorState] = React.useState<string>(initialState);
  function onChange(editorState: EditorState) {
    console.log(JSON.stringify(editorState.toJSON()))
    // Call toJSON on the EditorState object, which produces a serialization safe string
    const editorStateJSON = editorState.toJSON();
    // However, we still have a JavaScript object, so we need to convert it to an actual string with JSON.stringify
    setEditorState(JSON.stringify(editorStateJSON));
  }
  return (
    <div>
      <Editor placeholder={<Placeholder />} onChange={onChange} initialEditorState={editorState} />
    </div>
  );
};

Read mode example:

<Editor editable={false} />

Try to use it

0.3.0

2 days ago

0.3.2

2 days ago

0.3.1

2 days ago

0.2.3

7 days ago

0.2.4

7 days ago

0.2.2

10 days ago

0.2.1

11 days ago

0.2.0

11 days ago

0.1.8

12 days ago

0.1.7

14 days ago

0.1.4

15 days ago

0.1.6

15 days ago

0.1.5

15 days ago

0.1.2

15 days ago

0.1.3

15 days ago

0.1.1

21 days ago

0.1.0

22 days ago