editor.js icon indicating copy to clipboard operation
editor.js copied to clipboard

renderFromHTML on ready causing undefined error

Open Luppakorva opened this issue 4 years ago • 3 comments

Question

I have HTML saved on database and have torender it for the EditorJS in cases of edit, however running to undefined when trying to use renderFromHTML. Any way to solve this?

Context

Found out there's renderFromHTML and trying to use it on ready:

onReady: () => { editEditor.blocks.renderFromHTML("htmlContent}");},

This however leads to:

editorjs@latest:6 Uncaught TypeError: Cannot read properties of undefined (reading 'holder') editorjs@latest:6 Uncaught TypeError: Cannot read properties of undefined (reading 'tool') when editor div is clicked.

I tried to add isready inside document ready (running jquery) outside of the editor init itself, but this didn't help. Even tried to add timeout, but that did not help either.

Is there a way to do this in javascript / jquery environment? Running this on Laravel based project with jquery.

Luppakorva avatar Dec 16 '21 17:12 Luppakorva

I'm seeing the same bug. Commenting out the renderFromHTML makes it work again

luciancic avatar Feb 24 '22 20:02 luciancic

Same here. Had to do if (content.trim()) { ...renderFromHTML(content) }

faerot avatar Mar 24 '22 13:03 faerot

im getting the same issue with latest version