add template keybind (fixes #52)
This commit is contained in:
parent
bf60cde52c
commit
a35f8ff59b
|
@ -7,6 +7,7 @@ import {
|
|||
useState,
|
||||
} from "react";
|
||||
import { IRouterData, Router } from "../lib/router";
|
||||
import { KeybindManager } from "../lib/keybinds";
|
||||
|
||||
interface ITemplate {
|
||||
/**
|
||||
|
@ -74,10 +75,16 @@ export const TemplateContext = ({ children }: PropsWithChildren) => {
|
|||
}
|
||||
};
|
||||
|
||||
const handleToggleTemplate = () => {
|
||||
setEnable((en) => !en);
|
||||
};
|
||||
|
||||
Router.on("navigate", handleNavigate);
|
||||
KeybindManager.on("TOGGLE_TEMPLATE", handleToggleTemplate);
|
||||
|
||||
return () => {
|
||||
Router.off("navigate", handleNavigate);
|
||||
KeybindManager.on("TOGGLE_TEMPLATE", handleToggleTemplate);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
|
|
@ -31,6 +31,11 @@ const KEYBINDS = enforceObjectType({
|
|||
alt: true,
|
||||
},
|
||||
],
|
||||
TOGGLE_TEMPLATE: [
|
||||
{
|
||||
key: "KeyT",
|
||||
},
|
||||
],
|
||||
TOGGLE_BLANK: [
|
||||
{
|
||||
key: "KeyV", // legacy pxls keybind
|
||||
|
|
Loading…
Reference in New Issue