summaryrefslogtreecommitdiff
path: root/apps/web/src/lib/commands/base-command.ts
blob: 2d0d04b7d898d94303857c502cb58f035e7fcd1e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import type { EditorSelectionPatch } from "@/lib/selection/editor-selection";

export interface CommandResult {
	selection?: EditorSelectionPatch;
}

export abstract class Command {
	abstract execute(): CommandResult | undefined;

	undo(): void {
		throw new Error("Undo not implemented for this command");
	}

	redo(): CommandResult | undefined {
		return this.execute();
	}
}