question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do I reset the editor without losing the plugins?

See original GitHub issue

How do I reset the editor without losing the plugins? For example

    reset(){
        this.setState({
            editorState: EditorState.createEmpty()
        })
    }

this resets the editor but loses the decorators

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

9reactions
nadimtuhincommented, May 3, 2016

Thanks. Its working now.


    reset = () => {
        const editorState = EditorState.push(this.state.editorState, ContentState.createFromText(''));
        this.setState({ editorState });
    };

3reactions
adrianmclicommented, May 2, 2016

You have to push onto your existing editorState. So first you must create a contentState and then use the push method from EditorState to create a new EditorState that preserves your old editorState’s plugins.

See this for more info: https://facebook.github.io/draft-js/docs/api-reference-editor-state.html#push

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Reset a WordPress Site With or Without a Plugin
1. Go to Tools > WP Reset. · 2. Click the Tools tab. · 3. Click the link labelled “Delete Themes.” · 4....
Read more >
making an edit without plugins! || editing challenge #1
When was the last time you made an edit without plugins ? Can't remember? Neither can I!In today's video, I decided to challenge...
Read more >
Restore The Classic WordPress Editor In Two Steps
First, go to Dashboard > Plugins > Add New. Then, install and activate the Classic Editor plugin from the repository. If you had...
Read more >
How to Completely Reset Your WordPress Website Without ...
How to Reset Your WordPress Website Without a Plugin · Step 1: Delete the Database · Step 2: Create a New Database ·...
Read more >
how to reset vim's settings (including plugins, .vimrc file) ...
If the problem is to lose the current state of tabpages, ... This command saves your current editing session, restarts Vim and restores...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found