Skip to content

Commit f0735ee

Browse files
committed
feat: expose canUndo/canRedo on the Edit class
1 parent 7560f02 commit f0735ee

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/core/edit-session.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,16 @@ export class Edit {
10451045
}
10461046
});
10471047
}
1048+
/** True when there is a command to undo (the history pointer is not before the first command). */
1049+
public get canUndo(): boolean {
1050+
return this.commandIndex >= 0;
1051+
}
1052+
1053+
/** True when there is a command ahead to redo (the history pointer is not at the latest command). */
1054+
public get canRedo(): boolean {
1055+
return this.commandIndex < this.commandHistory.length - 1;
1056+
}
1057+
10481058
/** @internal */
10491059
public setUpdatedClip(clip: Player, initialClipConfig: ResolvedClip | null = null, finalClipConfig: ResolvedClip | null = null): void {
10501060
// Find track and clip indices

0 commit comments

Comments
 (0)