adds undo, redo shortcuts
This commit is contained in:
@@ -4,6 +4,7 @@ import { TrashIcon, ResetIcon } from "@radix-ui/react-icons";
|
|||||||
import "./styles.css";
|
import "./styles.css";
|
||||||
import { useStore } from "../../../store";
|
import { useStore } from "../../../store";
|
||||||
import { PopoverPeopleList } from "../PeopleList";
|
import { PopoverPeopleList } from "../PeopleList";
|
||||||
|
import { useUndoRedoShortcut } from "../../../utils";
|
||||||
// import { EDIT_MODE } from "../../../utils";
|
// import { EDIT_MODE } from "../../../utils";
|
||||||
|
|
||||||
export const BottomBar = () => {
|
export const BottomBar = () => {
|
||||||
@@ -51,6 +52,8 @@ export const BottomBar = () => {
|
|||||||
setSelection({});
|
setSelection({});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useUndoRedoShortcut(undo, redo);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="BottomBar">
|
<div className="BottomBar">
|
||||||
<button className="Button violet" onClick={undo}>
|
<button className="Button violet" onClick={undo}>
|
||||||
|
|||||||
@@ -78,3 +78,19 @@ export const useDeleteShortcut = (selected, setBricks, onDelete) => {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const useUndoRedoShortcut = (undo, redo) => {
|
||||||
|
useKeyboardShortcut(["Control", "Z"], undo, {
|
||||||
|
overrideSystem: true,
|
||||||
|
ignoreInputFields: false,
|
||||||
|
repeatOnHold: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
useKeyboardShortcut(["Control", "R"], redo, {
|
||||||
|
overrideSystem: true,
|
||||||
|
ignoreInputFields: false,
|
||||||
|
repeatOnHold: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user