jodit / jodit/jodit-react

Fix README example: wrap config with useMemo()!

Open
#153 4 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
406
Forks
131
Avg merge
2h 32m
Merged PRs (30d)
2

Description

I mean section
https://github.com/jodit/jodit-react#1-require-and-use-jodit-react-component-inside-your-application

Replace

const Example = ({}) => {
const config = {
    readonly: false // all options from https://xdsoft.net/jodit/doc/
};

with

const Example = ({placeholder}) => {
const config: JoditEditorOptions = useMemo(() => ({
    // all options from https://xdsoft.net/jodit/doc/
    readonly: false 
    placeholder: placeholder || 'Start typing here...', 
}), [placeholder])

Without this fix editor may lose focus every time you change it's value.

See https://github.com/jodit/jodit-react/issues/43#issuecomment-580152633

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the README section linked in the issue, titled “Require and use Jodit React component inside your application,” and compare its Example component and config snippet with the requested usage. Update the example so its configuration is stable and supports the placeholder shown in the issue; done means the README reflects the requested example without the focus-loss warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
documentation, frontend
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.