Skip to content

Commit

Permalink
chore: add BaseCommand type
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed May 8, 2022
1 parent 9e7f1ad commit c58bb56
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions projects/ngx-editor/src/lib/commands/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit c58bb56

Please sign in to comment.