Skip to content

Commit

Permalink
feat: add canUndo() and canRedo(). (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
yfwz100 authored Mar 6, 2024
1 parent 0432cf0 commit 73b7354
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/history/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ class History {
}
}

canRedo() {
return this.stack.redo.length > 0;
}

redo() {
this.change('redo', 'undo');
}
Expand All @@ -152,6 +156,10 @@ class History {
transformStack(this.stack.redo, op);
}

canUndo() {
return this.stack.undo.length > 0;
}

undo() {
this.change('undo', 'redo');
}
Expand Down

0 comments on commit 73b7354

Please sign in to comment.