add template keybind (fixes #52)

This commit is contained in:
Grant 2024-06-19 10:47:27 -06:00
parent bf60cde52c
commit a35f8ff59b
2 changed files with 12 additions and 0 deletions

View File

@ -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);
};
}, []);

View File

@ -31,6 +31,11 @@ const KEYBINDS = enforceObjectType({
alt: true,
},
],
TOGGLE_TEMPLATE: [
{
key: "KeyT",
},
],
TOGGLE_BLANK: [
{
key: "KeyV", // legacy pxls keybind