Skip to content

feat(playground): register Header tool - #163

Open
Reversean wants to merge 1 commit into
feat/header-apifrom
feat/header-playground
Open

feat(playground): register Header tool#163
Reversean wants to merge 1 commit into
feat/header-apifrom
feat/header-playground

Conversation

@Reversean

@Reversean Reversean commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Registers @editorjs/header in the playground.

Getting Header to actually render surfaced two bugs, both fixed here.

  • BlockManager.insert spread a block's data onto the block object's own top-level properties instead of nesting it under data, so every tool lost its data on insert.
  • ToolboxUI.addTool read tool.options.toolbox and added a single popover entry per tool; it now iterates tool.toolbox, since a tool can define several entries (Header has one per heading level) and only the first ever showed up.

Header wasn't wired into the playground, so there was no way to see its config-driven toolbox running in the actual editor rather than only in its own unit tests. Registered with all six levels enabled via config.levels.

Getting it to actually work surfaced two bugs: BlockManager.insert flattened a block's data onto its top-level properties instead of nesting it under data, dropping every tool's data on insert; and ToolboxUI.addTool only added one toolbox entry for a tool with several, instead of iterating all of them.

@gohabereg gohabereg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add @editorjs/editorjs pacakge inside the monorepo. Mark it private for now.

This package should import Core and all the Tools and register them. Export the core with registered tools.

Playground should use import from editorjs/editorjs package instead of core.

Registrations inside the core could be removed

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

Unit Tests

Package Coverage Delta
@editorjs/core 73.14% N/A
@editorjs/model 98.48% N/A
@editorjs/clipboard-plugin 66.66% N/A
@editorjs/dom-adapters 86.95% N/A
@editorjs/ot-server 20% N/A
@editorjs/shortcuts-plugin 100% N/A
@editorjs/editorjs 100% N/A

Mutation Tests

Package Mutation score Dashboard URL
@editorjs/core 88.89% 🟢 Dashboard
@editorjs/clipboard-plugin No files to mutate found.
@editorjs/model No files to mutate found.
@editorjs/dom-adapters No files to mutate found.
@editorjs/shortcuts-plugin No files to mutate found.

@Reversean
Reversean force-pushed the feat/header-api branch 2 times, most recently from d357ed7 to 024f958 Compare August 28, 2026 10:17
@Reversean
Reversean force-pushed the feat/header-playground branch 2 times, most recently from 7b85b74 to 5757d78 Compare August 28, 2026 10:26
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.

2 participants