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

[Bug] `Cannot read property 'updateCurrentInput' of undefined` when adding two instances of the editor #1557

Open rama-adi opened 3 years ago

rama-adi commented 3 years ago

Describe a bug. when I try to add 2 instances, the editor throws an error:

editorjs@latest:6 Uncaught TypeError: Cannot read property 'updateCurrentInput' of undefined
    at y.value (editorjs@latest:6)
    at k.value (editorjs@latest:6)
    at HTMLDocument.<anonymous> (editorjs@latest:6)

Steps to reproduce:

  1. add the EditorJS script
  2. Add 2 divs with different ID (ex: editor1 and editor2)
  3. Initialize those divs with the editor
  4. try clicking the (+) icon and adding some blocks
  5. Check console

Expected behavior: No errors when creating multiple instances

Screenshots: image

Device, Browser, OS: Windows 10, Chrome Version 88.0.4324.150 (Official Build) (64-bit)

Editor.js version: Latest

Plugins you use with their versions: No plugins, straight from the CDN

elbakerino commented 3 years ago

Duplicate to #1503