Editor.js: [Bug] Uncaught TypeError: Cannot read property 'updateCurrentInput' of undefined

Created on 16 Jan 2021  Â·  12Comments  Â·  Source: codex-team/editor.js

When I click on a block of any EditorJS instance when there are two editors in the same page, I get the following error:

Uncaught TypeError: Cannot read property 'updateCurrentInput' of undefined

This is where the error is produced:

https://github.com/codex-team/editor.js/blob/43032ebaac6a8b9a67c9bf2ada5adc0f8592d546/src/components/modules/blockManager.ts#L566-L593

Steps to reproduce:

  1. Create two editors in the same page
  2. Click on a block

Expected behavior: No errors reported to the console.

Device, Browser, OS: Chromium 87

Editor.js version: 2.19.1

bug

Most helpful comment

https://github.com/codex-team/editor.js/pull/1364/files#diff-73cbc05ddd84b0686ee89460cb98dfc39099c8472677e743192f301e26c2347cR584

This error occurs in BlockManager.setCurrentBlockByChildNode()

I sent a pull request.

All 12 comments

Hi,
I have the same problem.
Currently using the editor on a Modal developed on React. When you open the modal again the error appears on the console.

i got the same thing

I have the same problem, using Editor.js on React

it's same for me too when i am using more than one editor instances in the same page

I got the same. Using editor on modal with Vuejs

I got the same error using the editor in nuxtjs. I have a toggle button which hides the editor. After toggling once the error occurs.

Hey guys,
Had the same issue using React and was digging around for days trying to fix it. Figured out a way that seems to work.

Make sure you are initializing the editor using Class-based component, and then call editor.destroy() on unmount

componentWillUnmount() { this.editor.destroy() }

this.editor.destroy() works for me too in Vue.js

Seems editor.js does not support multiple editors in one page?

This bug occurs in the following demo page.
https://hata6502.github.io/editorjs-inline/

スクリーンショット 2021-01-25 19 57 37

Editor.js supported multiple instances in v.2.18.0.
But it seems broken in recently version.

https://github.com/codex-team/editor.js/pull/1364/files#diff-73cbc05ddd84b0686ee89460cb98dfc39099c8472677e743192f301e26c2347cR584

This error occurs in BlockManager.setCurrentBlockByChildNode()

I sent a pull request.

this.editor.destroy() works for me too in Vue.js

Please show exemple.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

guillaumepn picture guillaumepn  Â·  4Comments

hata6502 picture hata6502  Â·  3Comments

vsvanshi picture vsvanshi  Â·  4Comments

neSpecc picture neSpecc  Â·  4Comments

sei-jdshimkoski picture sei-jdshimkoski  Â·  5Comments