fix undo and redo actions

pull/5899/head
sawhney17 2022-06-22 07:36:39 +04:00
parent 39f567b1fa
commit 3a31b28581
2 changed files with 3 additions and 12 deletions

View File

@ -9,21 +9,14 @@ import { RedoIcon, UndoIcon } from '~components/icons'
export const ActionBar = observer(function ToolBar(): JSX.Element {
const app = useApp<Shape>()
const undo = React.useCallback(() => {
app.api.undo()
}, [app])
const redo = React.useCallback(() => {
app.api.redo()
}, [app])
return (
<div className="action-bar">
<button onClick={undo}>
<button onClick={app.api.undo}>
<UndoIcon></UndoIcon>
</button>
<button onClick={redo}>
<button onClick={app.api.redo}>
<RedoIcon></RedoIcon>
</button>
</div>

View File

@ -177,13 +177,11 @@ export class TLApi<S extends TLShape = TLShape, K extends TLEventMap = TLEventMa
}
undo = () => {
this.app.undo()
this.app.undo()
return this
}
redo = () => {
this.app.redo()
this.app.redo()
return this
}