Skip to content

feat: add @editorjs/header package#162

Open
Reversean wants to merge 1 commit into
mainfrom
feat/header-api
Open

feat: add @editorjs/header package#162
Reversean wants to merge 1 commit into
mainfrom
feat/header-api

Conversation

@Reversean

@Reversean Reversean commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add packages/tools/header — a new @editorjs/header block tool:

    • Three toolbox entries (H1 / H2 / H3), each with data.level pre-filled
    • Correct event-listener ordering in constructor (addEventListener before registerTextInputKey/registerValueKey so the synchronously-dispatched KeyAddedEvent is never missed)
    • Swaps the heading DOM element on ValueNodeChangedEvent(level) for future Block Tunes integration
    • 36 unit tests covering constructor, render, and all event handlers
  • Fix BlockManager.insert: pass { data, id, name } instead of { ...data, id, name } — the spread silently flattened tool data into top-level BlockNodeInit properties which BlockNode doesn't read, so data.level was always lost

  • Fix ToolboxUI.addTool: use tool.toolbox facade getter (returns normalized ToolboxConfigEntry[]) and iterate with for...of instead of spreading a raw value that may be an array — previously only a single broken entry was added for tools with multi-entry toolboxes

- Add packages/tools/header with Header block tool:
  • three toolbox entries (H1/H2/H3) each carrying their level in data
  • registers text + level keys in the correct order
    (addEventListener before registerTextInputKey/registerValueKey,
     so synchronously-fired KeyAddedEvent is never missed)
  • swaps heading tag on ValueNodeChangedEvent(level)
  • 36 unit tests

- Fix BlockManager.insert: pass { data, id, name } instead of
  { ...data, id, name } so tool data is not silently flattened
  into top-level BlockNodeInit properties

- Fix ToolboxUI.addTool: iterate tool.toolbox (normalized array via
  facade getter) with for…of instead of spreading a raw value that
  may be an array or single object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant