Skip to content

Commit 87b3c03

Browse files
authored
fix(web): fix monaco editor key binding (#1809)
1 parent c3e0bca commit 87b3c03

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

web/src/components/Editor/FunctionEditor.tsx

+5-12
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ import {
66
registerFileSystemOverlay,
77
} from "vscode/service-override/files";
88

9-
import { APP_STATUS, COLOR_MODE, Pages, RUNTIMES_PATH } from "@/constants";
9+
import { APP_STATUS, COLOR_MODE, RUNTIMES_PATH } from "@/constants";
1010

1111
import "./useWorker";
1212

1313
import { createUrl, createWebSocketAndStartClient, performInit } from "./LanguageClient";
1414

1515
import { TFunction } from "@/apis/typing";
1616
import useFunctionCache from "@/hooks/useFunctionCache";
17-
import useHotKey, { DEFAULT_SHORTCUTS } from "@/hooks/useHotKey";
1817
import useFunctionStore from "@/pages/app/functions/store";
1918
import useGlobalStore from "@/pages/globalStore";
2019

@@ -54,16 +53,6 @@ function FunctionEditor(props: {
5453
}
5554
}, [baseUrl]);
5655

57-
useHotKey(
58-
DEFAULT_SHORTCUTS.send_request,
59-
() => {
60-
editorRef.current?.trigger("keyboard", "editor.action.formatDocument", {});
61-
},
62-
{
63-
enabled: globalStore.currentPageId === Pages.function,
64-
},
65-
);
66-
6756
useEffect(() => {
6857
const startLSP = () => {
6958
const lspWebSocket = createWebSocketAndStartClient(url, globalStore.currentApp.develop_token);
@@ -159,6 +148,10 @@ function FunctionEditor(props: {
159148
scrollBeyondLastLine: false,
160149
value: value,
161150
});
151+
monaco.editor.addKeybindingRule({
152+
keybinding: monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyP,
153+
command: null,
154+
})
162155
});
163156
}
164157

0 commit comments

Comments
 (0)