Commit a35f8ff5 authored by Grant's avatar Grant
Browse files

add template keybind (fixes #52)

parent bf60cde5
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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);
    };
  }, []);

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