Conversation
gohabereg
commented
May 3, 2026
- Added id to the BlockNodes wit
- BlockToolAdapter and BlockManager now refer to blocks by id to avoid re-indexing
…nputs-registration
…nputs-registration
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟢 | Statements | 96.43% | 27/28 |
| 🟢 | Branches | 86.96% | 20/23 |
| 🟢 | Functions | 100% | 5/5 |
| 🟢 | Lines | 96.43% | 27/28 |
Test suite run success
11 tests passing in 2 suites.
Report generated by 🧪jest coverage report action from 0c4e32b
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟢 | Statements | 100% | 129/129 |
| 🟢 | Branches | 100% | 47/47 |
| 🟢 | Functions | 100% | 27/27 |
| 🟢 | Lines | 100% | 120/120 |
Show new covered files 🐣
St.❔ |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| 🟢 | ... / BlockManager.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / BlockRenderer.ts |
100% | 100% | 100% | 100% |
Test suite run success
75 tests passing in 7 suites.
Report generated by 🧪jest coverage report action from 0c4e32b
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟢 | Statements | 99.8% (+0.01% 🔼) |
988/990 |
| 🟢 | Branches | 98.98% (+0.03% 🔼) |
292/295 |
| 🟢 | Functions | 97.45% (-0.33% 🔻) |
229/235 |
| 🟢 | Lines | 99.79% (+0.01% 🔼) |
948/950 |
Show new covered files 🐣
St.❔ |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| 🟢 | ... / BlockId.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / BlockAlreadyExistsError.ts |
100% | 100% | 100% | 100% |
Show files with reduced coverage 🔻
St.❔ |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| 🟢 | ... / index.ts |
100% | 100% | 91.67% (-2.27% 🔻) |
100% |
Test suite run success
538 tests passing in 25 suites.
Report generated by 🧪jest coverage report action from 0c4e32b
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟢 | Statements | 92.51% | 358/387 |
| 🟢 | Branches | 85.51% | 118/138 |
| 🟢 | Functions | 98.15% | 53/54 |
| 🟢 | Lines | 92.41% | 353/382 |
Test suite run success
117 tests passing in 7 suites.
Report generated by 🧪jest coverage report action from 0c4e32b
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟡 | Statements | 70.97% | 22/31 |
| 🔴 | Branches | 20% | 1/5 |
| 🟡 | Functions | 75% | 6/8 |
| 🟡 | Lines | 68.97% | 20/29 |
Test suite run success
4 tests passing in 1 suite.
Report generated by 🧪jest coverage report action from 0c4e32b
|
⏭️ No files to mutate for |
|
⏭️ No files to mutate for |
|
⏭️ No files to mutate for |
There was a problem hiding this comment.
Pull request overview
This PR introduces persistent block IDs across the model/SDK/core stack so blocks can be addressed by identity instead of by mutable array index. It also refactors block rendering and DOM adapter wiring around that new identity-based flow, which is foundational for more stable editor state management.
Changes:
- Adds
idsupport to block serialization/init paths and exposes id-based lookup helpers in the model. - Refactors core/dom-adapters to create block adapters through an adapter plugin and render blocks via a dedicated
BlockRenderer. - Updates tools, tests, mocks, and fixtures to work with block IDs and the new adapter/event model.
Reviewed changes
Copilot reviewed 60 out of 62 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Lockfile updates for Inversify/jsdom dependency changes. |
| packages/sdk/src/tools/facades/InlineToolFacade.ts | Caches inline tool instances as singletons. |
| packages/sdk/src/tools/facades/BaseToolFacade.ts | Broadens block tool constructor typing. |
| packages/sdk/src/entities/index.ts | Re-exports adapter/plugin entities. |
| packages/sdk/src/entities/EventBus/events/index.ts | Exports new adapter event group. |
| packages/sdk/src/entities/EventBus/events/adapter/ValueNodeChanged.ts | Adds adapter value-change event. |
| packages/sdk/src/entities/EventBus/events/adapter/KeyRemoved.ts | Adds adapter key-removed event. |
| packages/sdk/src/entities/EventBus/events/adapter/KeyAdded.ts | Adds adapter key-added event. |
| packages/sdk/src/entities/EventBus/events/adapter/index.ts | Barrel export for adapter events. |
| packages/sdk/src/entities/EventBus/events/adapter/AdapterEventType.ts | Defines adapter event names. |
| packages/sdk/src/entities/EntityType.ts | Adds adapter plugin type. |
| packages/sdk/src/entities/EditorjsPlugin.ts | Makes plugin constructors generic. |
| packages/sdk/src/entities/EditorjsAdapterPlugin.ts | Defines adapter plugin contract. |
| packages/sdk/src/entities/BlockToolAdapter.ts | Replaces interface with abstract id-based adapter base. |
| packages/sdk/src/entities/BlockTool.ts | Makes block tool adapter type generic. |
| packages/sdk/src/api/BlocksAPI.ts | Accepts block init objects for insertMany. |
| packages/sdk/package.json | Adds jsdom test dependency. |
| packages/sdk/jest.config.ts | Switches SDK tests to jsdom. |
| packages/playground/src/components/Input.vue | Removes old playground input helper. |
| packages/playground/src/components/index.ts | Drops removed playground component export. |
| packages/ot-server/src/DocumentManager.spec.ts | Loosens expectations to tolerate block IDs. |
| packages/model/src/mocks/data.ts | Adds IDs to mock document blocks. |
| packages/model/src/entities/inline-fragments/TextNode/TextNode.spec.ts | Tests serialized text node marker field. |
| packages/model/src/entities/EditorDocument/index.ts | Adds id-aware block APIs and lookup map. |
| packages/model/src/entities/EditorDocument/EditorDocument.spec.ts | Adds tests for new document getters. |
| packages/model/src/entities/BlockNode/types/index.ts | Re-exports block ID types/helpers. |
| packages/model/src/entities/BlockNode/types/BlockNodeSerialized.ts | Adds block id and BlockNodeInit. |
| packages/model/src/entities/BlockNode/types/BlockNodeConstructorParameters.ts | Allows optional constructor ID. |
| packages/model/src/entities/BlockNode/types/BlockId.ts | Introduces nominal block ID type/generator. |
| packages/model/src/entities/BlockNode/index.ts | Stores/serializes IDs and changes data-node init/events. |
| packages/model/src/entities/BlockNode/BlockNode.spec.ts | Updates tests for IDs/data-node behavior. |
| packages/model/src/entities/BlockNode/mocks/index.ts | Adds mocked getDataNode. |
| packages/model/src/EditorJSModel.ts | Exposes block-id and data-node helper APIs. |
| packages/model/src/EditorJSModel.spec.ts | Tests new model APIs. |
| packages/model/jest.config.ts | Formatting-only config cleanup. |
| packages/dom-adapters/tsconfig.json | Enables decorator metadata emission. |
| packages/dom-adapters/src/tokens.ts | Adds IoC token definitions. |
| packages/dom-adapters/src/InputsRegistry/index.ts | Adds shared blockId/dataKey input registry. |
| packages/dom-adapters/src/index.ts | Introduces DOM adapter plugin entrypoint. |
| packages/dom-adapters/src/FormattingAdapter/index.ts | Refactors formatting adapter to IoC/tool events. |
| packages/dom-adapters/src/CaretAdapter/index.ts | Reworks caret mapping around InputsRegistry/block IDs. |
| packages/dom-adapters/src/BlockToolAdapter/index.ts | Replaces old DOM adapter with id-based implementation. |
| packages/dom-adapters/package.json | Adds Inversify/reflect-metadata dependencies. |
| packages/core/src/utils/composeDataFromVersion2.ts | Returns block init objects. |
| packages/core/src/tools/ToolsManager.ts | Migrates tool manager to Inversify. |
| packages/core/src/tools/internal/block-tools/paragraph/index.ts | Rebuilds paragraph rendering around adapter events. |
| packages/core/src/tokens.ts | Adds core IoC tokens. |
| packages/core/src/index.ts | Refactors core bootstrapping/plugin registration for adapters. |
| packages/core/src/components/SelectionManager.ts | Moves inline-format application logic into core selection manager. |
| packages/core/src/components/SelectionManager.spec.ts | Updates tests for new selection/tool flow. |
| packages/core/src/components/BlockRenderer.ts | Adds dedicated block rendering component. |
| packages/core/src/components/BlockRenderer.spec.ts | Tests new block renderer behavior. |
| packages/core/src/components/BlockManager.ts | Removes rendering concerns; focuses on block operations. |
| packages/core/src/components/BlockManager.spec.ts | Updates block manager tests for refactor. |
| packages/core/src/api/SelectionAPI.ts | Migrates selection API to Inversify. |
| packages/core/src/api/index.ts | Migrates editor API aggregation to Inversify. |
| packages/core/src/api/DocumentAPI/DocumentAPI.ts | Migrates document API to Inversify. |
| packages/core/src/api/BlocksAPI.ts | Updates blocks API typing/DI. |
| packages/core/src/api/BlocksAPI.integration.spec.ts | Adjusts integration tests for IDs/refactor. |
| packages/core/package.json | Replaces TypeDI with Inversify. |
| packages/collaboration-manager/src/CollaborationManager.spec.ts | Loosens block expectations to tolerate IDs. |
| .nvmrc | Updates pinned Node version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.