Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't set value by value prop #200

Open
pisacode opened this issue May 17, 2022 · 7 comments · May be fixed by #205
Open

Can't set value by value prop #200

pisacode opened this issue May 17, 2022 · 7 comments · May be fixed by #205
Labels
bug Something isn't working

Comments

@pisacode
Copy link

Environment

  • react-editor-js version:2.24.3

Describe

When setting value editor throws an error => this._editorJS.render is not a function at ClientEditorCore.<anonymous>

I also tried added via data prop but the value is not passing by that either.

<ReactEditorJS
        tools={EDITOR_JS_TOOLS}
        readOnly={isReadOnly}
        onInitialize={handleInitialize}
        enableReInitialize
        value={editorCore.current ? content : null}
      />

@pisacode pisacode added the bug Something isn't working label May 17, 2022
@milosglickon
Copy link

Environment

  • react-editor-js version:2.24.3

Describe

When setting value editor throws an error => this._editorJS.render is not a function at ClientEditorCore.<anonymous>

I also tried added via data prop but the value is not passing by that either.

<ReactEditorJS
        tools={EDITOR_JS_TOOLS}
        readOnly={isReadOnly}
        onInitialize={handleInitialize}
        enableReInitialize
        value={editorCore.current ? content : null}
      />

having the same problem. I am unable to update the value once the props are updated

@idontreallywolf
Copy link

idontreallywolf commented Jul 5, 2022

adding yield this._editorJS.isReady; before calling render has solved the issue 👀
a possible fix maybe? @Jungwoo-An

render(data) {
    return __awaiter(this, void 0, void 0, function* () {
        yield this._editorJS.isReady;
        yield this._editorJS.render(data);
    });
}

@idontreallywolf idontreallywolf linked a pull request Jul 6, 2022 that will close this issue
2 tasks
@EthanL06
Copy link

adding yield this._editorJS.isReady; before calling render has solved the issue 👀 a possible fix maybe? @Jungwoo-An

render(data) {
    return __awaiter(this, void 0, void 0, function* () {
        yield this._editorJS.isReady;
        yield this._editorJS.render(data);
    });
}

Was able to update the value with your fix:

const updateValue = (data) => {
  editorCore.current._editorJS.isReady.then(() => {
      editorCore.current._editorJS.render(data);
  });
}

@MaximumQuiet
Copy link

@Jungwoo-An Hi! Do you have time to check this? We need this to make things work :(

@MaherAzzabi
Copy link

MaherAzzabi commented Feb 15, 2023

Any updates on the fix please ? do you have a release date for it ? thanks

@orbachar
Copy link

+1

@SwapnilSoni1999
Copy link

Anyone fixed this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants