Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,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
*/
this.#iocContainer.get(BlockRenderer);
this.#iocContainer.get(BlocksManager);
this.#iocContainer.get(SelectionManager);

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) {
Expand Down
8 changes: 8 additions & 0 deletions packages/dom-adapters/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -49,6 +51,12 @@ export class DOMAdapters implements EditorJSAdapterPlugin {
.bind(DOMBlockToolAdapter)
.toSelf()
.inTransientScope();

/**
* Initialize singleton adapters
*/
this.#iocContainer.get(FormattingAdapter);
this.#iocContainer.get(CaretAdapter);
Comment thread
gohabereg marked this conversation as resolved.
}

/**
Expand Down