From 088abf6c1199c6c86a6ec52467f83d025e302d40 Mon Sep 17 00:00:00 2001 From: gohabereg Date: Thu, 7 May 2026 23:56:41 +0100 Subject: [PATCH 1/2] Fix DOM inline formatting --- packages/core/src/index.ts | 16 +++++++++++----- packages/dom-adapters/src/index.ts | 8 ++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 002d8555..98a40875 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,5 +1,6 @@ import { CollaborationManager } from '@editorjs/collaboration-manager'; import { type DocumentId, EditorJSModel, EventType } from '@editorjs/model'; +import type { ServiceIdentifier } from 'inversify'; import { Container } from 'inversify'; import { type BlockToolConstructor, @@ -174,14 +175,19 @@ export default class Core { this.#initializeAdapter(); - this.#initializePlugins(); + /** + * Need to initialize internal modules before plugins and tools + * @todo think of how to remove this? + * @todo add e2e initialization tests + * Currently only BlockRenderer would be enough, but that would be hard to debug. Easier just add every module here + */ + [BlockRenderer, BlocksManager, SelectionManager].forEach((module) => { + this.#iocContainer.get(module as ServiceIdentifier); + }); + this.#initializePlugins(); await this.#initializeTools(); - this.#iocContainer.get(SelectionManager); - this.#iocContainer.get(BlocksManager); - this.#iocContainer.get(BlockRenderer); - this.#model.initializeDocument({ blocks }); this.#collaborationManager.connect(); } catch (error) { diff --git a/packages/dom-adapters/src/index.ts b/packages/dom-adapters/src/index.ts index 5dbc2b43..6f969c3a 100644 --- a/packages/dom-adapters/src/index.ts +++ b/packages/dom-adapters/src/index.ts @@ -13,6 +13,8 @@ import type { BlockId } from '@editorjs/model'; import { Container } from 'inversify'; import { TOKENS } from './tokens.js'; import type { CoreConfig } from '@editorjs/sdk'; +import { FormattingAdapter } from './FormattingAdapter/index.js'; +import { CaretAdapter } from './CaretAdapter/index.js'; export * from './CaretAdapter/index.js'; export * from './FormattingAdapter/index.js'; @@ -49,6 +51,12 @@ export class DOMAdapters implements EditorJSAdapterPlugin { .bind(DOMBlockToolAdapter) .toSelf() .inTransientScope(); + + /** + * Initialize singleton adapters + */ + this.#iocContainer.get(FormattingAdapter); + this.#iocContainer.get(CaretAdapter); } /** From fd0143773e97efce22fe9dd066daf52abda0387b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 8 May 2026 20:46:38 +0000 Subject: [PATCH 2/2] Fix type safety: call get() explicitly instead of using `as ServiceIdentifier` cast Agent-Logs-Url: https://github.com/editor-js/document-model/sessions/6cc8bf67-e04e-456b-920e-f7aff60aedda Co-authored-by: gohabereg <23050529+gohabereg@users.noreply.github.com> --- packages/core/src/index.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 98a40875..35f39c36 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,6 +1,5 @@ import { CollaborationManager } from '@editorjs/collaboration-manager'; import { type DocumentId, EditorJSModel, EventType } from '@editorjs/model'; -import type { ServiceIdentifier } from 'inversify'; import { Container } from 'inversify'; import { type BlockToolConstructor, @@ -181,9 +180,9 @@ export default class Core { * @todo add e2e initialization tests * Currently only BlockRenderer would be enough, but that would be hard to debug. Easier just add every module here */ - [BlockRenderer, BlocksManager, SelectionManager].forEach((module) => { - this.#iocContainer.get(module as ServiceIdentifier); - }); + this.#iocContainer.get(BlockRenderer); + this.#iocContainer.get(BlocksManager); + this.#iocContainer.get(SelectionManager); this.#initializePlugins(); await this.#initializeTools();