0.4.1 • Published 1 year ago

kyz-editor v0.4.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year 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.6

1 year ago

0.3.8

1 year ago

0.3.7

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.3.5

1 year ago

0.3.4

1 year ago

0.3.3

1 year ago

0.3.0

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.2.3

1 year ago

0.2.4

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.4

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.2

1 year ago

0.1.3

1 year ago

0.1.1

2 years ago

0.1.0

2 years ago