Skip to content

Commit

Permalink
Add docs after review
Browse files Browse the repository at this point in the history
  • Loading branch information
gohabereg committed Aug 30, 2024
1 parent 3a7f004 commit 21d7ecf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/core/src/api/SelectionAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import { InlineToolFormatData } from '@editorjs/sdk';
export class SelectionAPI {
#selectionManager: SelectionManager;

/**
* SelectionAPI class constructor
* @param selectionManager - SelectionManager instance to work with selection and inline fotmatting
*/
constructor(
selectionManager: SelectionManager
) {
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ import { SelectionAPI } from './SelectionAPI.js';
*/
@Service()
export class EditorAPI {
/**
* Blocks API instance to work with blocks
*/
@Inject()
public blocks!: BlocksAPI;

/**
* Selection API instance to work with selection and inline formatting
*/
@Inject()
public selection!: SelectionAPI;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { CoreEventType } from './CoreEventType.js';
import type { Index, InlineToolName } from '@editorjs/model';

/**
* Payload of BlockAddedCoreEvent custom event
* Contains updated caret index
* Payload of SelectionChangedCoreEvent custom event
* Contains updated caret index and available inline tools
*/
export interface SelectionChangedCoreEventPayload {
/**
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/components/SelectionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export class SelectionManager {
*/
#eventBus: EventBus;

/**
* Inline Tools instances available for use
*/
#inlineTools: Map<InlineToolName, InlineTool> = new Map();

/**
Expand Down

0 comments on commit 21d7ecf

Please sign in to comment.