From c58bb56def8f3a09a5ebf35b05765958e5b6213e Mon Sep 17 00:00:00 2001 From: Sibiraj Date: Sun, 8 May 2022 16:53:11 +0530 Subject: [PATCH] chore: add BaseCommand type --- projects/ngx-editor/src/lib/commands/types.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/projects/ngx-editor/src/lib/commands/types.ts b/projects/ngx-editor/src/lib/commands/types.ts index 01dc6b39..539a821d 100644 --- a/projects/ngx-editor/src/lib/commands/types.ts +++ b/projects/ngx-editor/src/lib/commands/types.ts @@ -3,13 +3,15 @@ import { Command } from 'prosemirror-commands'; export type Dispatch = (tr: Transaction) => void | null; -export interface ToggleCommand { +interface BaseCommand { + canExecute: (state: EditorState) => boolean; +} + +export interface ToggleCommand extends BaseCommand { toggle: () => Command; isActive: (state: EditorState) => boolean; - canExecute: (state: EditorState) => boolean; } -export interface InsertCommand { +export interface InsertCommand extends BaseCommand { insert: () => Command; - canExecute: (state: EditorState) => boolean; }