Skip to content

Multiple EditorJS instances on the same page cause inline shortcut registration to fail #3002

@ldeaudit1

Description

@ldeaudit1

When multiple EditorJS instances are initialized on the same page, the second instance fails to register its inline tool shortcuts, causing an error thrown by Shortcuts.add().

This was introduced by the change from this.Editor.UI.nodes.redactor to document as the on target in inline.ts > enableShortcuts(). https://github.com/codex-team/editor.js/pull/2891/changes#diff-e55ad4bb9846bb8d75e77413ab3e49c30e75f6bb8b58833d2b539cebb8186b10

  1. Create two or more EditorJS instances on the same page with inline tools that have shortcuts (e.g. bold, italic, inlineCode)
  2. Initialize the second instance
  3. Observe the error

Expected behavior: Multiple EditorJS instances should be able to coexist on the same page without conflicting on inline shortcut registration.

Suggested Fix: One possible approach would be to conditionally bind shortcuts depending on the read-only mode.

Screenshots:

Image

Device, Browser, OS: Chromium 147.0.7727.116

Editor.js version: 2.31.6

Plugins you use with their versions: N/A

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions