codex-team / codex-team/editor.js

renderFromHTML on ready causing undefined error

Open
#1,841 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
31.9k
Forks
2.2k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

**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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.