codex-team / editor.js

A block-style editor with clean JSON output
https://editorjs.io
Apache License 2.0
27.62k stars 2.03k forks source link

addRange(): The given range isn't in document. #2282

Open 4e576rt8uh9ij9okp opened 1 year ago

4e576rt8uh9ij9okp commented 1 year ago

Describe a bug.

Steps to reproduce:

const editor = new EditorJS({
    holder: "editor",
    onReady: () => {
        editor.blocks.renderFromHTML("<h1>Hello there xD</h1>")
    },
    autofocus: true
})

Expected behavior: It shows the rendered TEXT fine, so not sure, it just shows this error.

Device, Browser, OS: Brave@latest

Editor.js version: 2.26.5

Plugins you use with their versions: none

Abacaxi-Nelson commented 1 year ago

Hello Did you fix it ?

LeviticusMaximus commented 11 months ago

I'm getting the same error, definitely stemming from renderFromHTML() - once again, the content renders well but I'm not loving the console error. My code:

const editor = new EditorJS({
  ...
    data: {
      time: props.blockContent?.time || 0,
      blocks: props.dataIsHtml ? undefined : props.blockContent?.blocks,
    },
    onReady: async () => {
      if (props.dataIsHtml) {
        await editor.blocks.renderFromHTML(htmlContent.value);
      }
    },
  ...
}
botstar-tra commented 7 months ago

Same issue.

dawidpstrak commented 4 months ago

I am also rendering from html and having this warning