mirror of https://github.com/logseq/logseq
fix undo and redo actions
parent
39f567b1fa
commit
3a31b28581
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue