From 4056e707a60f0754c4c0139332bf4d621f27a03f Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Fri, 30 Aug 2024 01:54:21 +0300 Subject: [PATCH] lint --- .../src/entities/EditorDocument/index.ts | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/model/src/entities/EditorDocument/index.ts b/packages/model/src/entities/EditorDocument/index.ts index c582ea7..ded4233 100644 --- a/packages/model/src/entities/EditorDocument/index.ts +++ b/packages/model/src/entities/EditorDocument/index.ts @@ -22,7 +22,7 @@ import { } from '../../EventBus/events/index.js'; import type { Constructor } from '../../utils/types.js'; import { BaseDocumentEvent } from '../../EventBus/events/BaseEvent.js'; -import { Index } from '../Index'; +import type { Index } from '../Index'; /** * EditorDocument class represents the top-level container for a tree-like structure of BlockNodes in an editor document. @@ -324,43 +324,43 @@ export class EditorDocument extends EventBus { return this.#children[blockIndex].getFragments(dataKey, start, end, tool); } - /** + /** * Inserts data to the specified index * * @param index - index to insert data * @param data - data to insert */ - public insertData(index: Index, data: unknown): void { - switch (true) { - case index.isTextIndex: - this.insertText(index.blockIndex!, index.dataKey!, data as string, index.textRange![0]); - break; - - case index.isBlockIndex: - // eslint-disable-next-line @typescript-eslint/no-magic-numbers - this.addBlock(data as Parameters[0], index.blockIndex); - default: - throw new Error('Unsupported index'); - } + public insertData(index: Index, data: unknown): void { + switch (true) { + case index.isTextIndex: + this.insertText(index.blockIndex!, index.dataKey!, data as string, index.textRange![0]); + break; + + case index.isBlockIndex: + // eslint-disable-next-line @typescript-eslint/no-magic-numbers + this.addBlock(data as Parameters[0], index.blockIndex); + default: + throw new Error('Unsupported index'); } + } - /** - * Removes data from the specified index - * - * @param index - index to remove data from - */ - public removeData(index: Index): void { - switch (true) { - case (index.blockIndex !== undefined && index.dataKey !== undefined && index.textRange !== undefined): - this.removeText(index.blockIndex, index.dataKey, index.textRange[0], index.textRange[1]); - break; - - case (index.blockIndex !== undefined): - this.removeBlock(index.blockIndex); - default: - throw new Error('Unsupported index'); - } + /** + * Removes data from the specified index + * + * @param index - index to remove data from + */ + public removeData(index: Index): void { + switch (true) { + case (index.blockIndex !== undefined && index.dataKey !== undefined && index.textRange !== undefined): + this.removeText(index.blockIndex, index.dataKey, index.textRange[0], index.textRange[1]); + break; + + case (index.blockIndex !== undefined): + this.removeBlock(index.blockIndex); + default: + throw new Error('Unsupported index'); } + } /** * Listens to BlockNode events and bubbles them to the EditorDocument