react-editor-js icon indicating copy to clipboard operation
react-editor-js copied to clipboard

Can't set value by value prop

Open pisacode opened this issue 2 years ago β€’ 7 comments

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 avatar May 17 '22 19:05 pisacode

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

milosglickon avatar Jun 21 '22 09:06 milosglickon

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 avatar Jul 05 '22 21:07 idontreallywolf

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);
  });
}

EthanL06 avatar Dec 27 '22 08:12 EthanL06

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

MaximumQuiet avatar Jan 20 '23 13:01 MaximumQuiet

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

MaherAzzabi avatar Feb 15 '23 16:02 MaherAzzabi

+1

orbachar avatar Mar 23 '23 21:03 orbachar

Anyone fixed this?

SwapnilSoni1999 avatar Jul 13 '23 10:07 SwapnilSoni1999