Skip to content

Commit

Permalink
Add edit in MakeCode shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-grace committed Dec 3, 2024
1 parent 4da13aa commit 7ab49ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/keyboard-shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const keyboardShortcuts = {
renameAction: ["F2"],
connect: ["ctrl+shift+c", "meta+shift+c"],
disconnect: ["ctrl+shift+d", "meta+shift+d"],
editInMakeCode: ["ctrl+shift+e", "meta+shift+e"],
};

export const globalShortcutConfig = {
Expand Down
9 changes: 8 additions & 1 deletion src/pages/TestingModelPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import {
VStack,
} from "@chakra-ui/react";
import { useCallback, useEffect, useState } from "react";
import { useHotkeys } from "react-hotkeys-hook";
import { RiDeleteBin2Line } from "react-icons/ri";
import { FormattedMessage, useIntl } from "react-intl";
import { useNavigate } from "react-router";
import { useBufferedData } from "../buffered-data-hooks";
import BackArrow from "../components/BackArrow";
import DefaultPageLayout, {
ProjectMenuItems,
Expand All @@ -27,10 +29,10 @@ import TestingModelTable from "../components/TestingModelTable";
import { useConnectActions } from "../connect-actions-hooks";
import { useConnectionStage } from "../connection-stage-hooks";
import { useProject } from "../hooks/project-hooks";
import { globalShortcutConfig, keyboardShortcuts } from "../keyboard-shortcuts";
import { useStore } from "../store";
import { tourElClassname } from "../tours";
import { createDataSamplesPageUrl } from "../urls";
import { useBufferedData } from "../buffered-data-hooks";

const TestingModelPage = () => {
const navigate = useNavigate();
Expand Down Expand Up @@ -96,6 +98,11 @@ const TestingModelPage = () => {
incompatibleEditorDeviceDisclosure.onClose();
setEditorLoading(false);
}, [incompatibleEditorDeviceDisclosure, openEditor]);
useHotkeys(
keyboardShortcuts.editInMakeCode,
maybeOpenEditor,
globalShortcutConfig
);

return model ? (
<DefaultPageLayout
Expand Down

0 comments on commit 7ab49ff

Please sign in to comment.