mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Make history actions immutable
This commit is contained in:
parent
642a11e380
commit
ccb886730b
2 changed files with 21 additions and 10 deletions
|
@ -214,10 +214,16 @@ export class App extends React.Component<{}, AppState> {
|
|||
} else if (event[META_KEY] && event.code === "KeyZ") {
|
||||
if (event.shiftKey) {
|
||||
// Redo action
|
||||
history.redoOnce(elements);
|
||||
const data = history.redoOnce(elements);
|
||||
if (data !== null) {
|
||||
elements = data;
|
||||
}
|
||||
} else {
|
||||
// undo action
|
||||
history.undoOnce(elements);
|
||||
const data = history.undoOnce(elements);
|
||||
if (data !== null) {
|
||||
elements = data;
|
||||
}
|
||||
}
|
||||
this.forceUpdate();
|
||||
event.preventDefault();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue