MCPcopy
hub / github.com/wavetermdev/waveterm / codeEditKeyDownHandler

Function codeEditKeyDownHandler

frontend/app/view/preview/preview-edit.tsx:48–62  ·  view source on GitHub ↗
(e: WaveKeyboardEvent)

Source from the content-addressed store, hash-verified

46 const language = baseName && shellFileMap[baseName] ? shellFileMap[baseName] : undefined;
47
48 function codeEditKeyDownHandler(e: WaveKeyboardEvent): boolean {
49 if (checkKeyPressed(e, "Cmd:e")) {
50 fireAndForget(() => model.setEditMode(false));
51 return true;
52 }
53 if (checkKeyPressed(e, "Cmd:s") || checkKeyPressed(e, "Ctrl:s")) {
54 fireAndForget(model.handleFileSave.bind(model));
55 return true;
56 }
57 if (checkKeyPressed(e, "Cmd:r")) {
58 fireAndForget(model.handleFileRevert.bind(model));
59 return true;
60 }
61 return false;
62 }
63
64 useEffect(() => {
65 model.codeEditKeyDownHandler = codeEditKeyDownHandler;

Callers

nothing calls this directly

Calls 3

checkKeyPressedFunction · 0.90
fireAndForgetFunction · 0.90
setEditModeMethod · 0.80

Tested by

no test coverage detected