From b7b813a4a7324fff0b046eab48661ac258de6213 Mon Sep 17 00:00:00 2001 From: sawka Date: Fri, 14 Jun 2024 00:15:09 -0700 Subject: [PATCH] Cmd-ESC now toggles both ways --- frontend/app/view/term.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/frontend/app/view/term.tsx b/frontend/app/view/term.tsx index 45f7f0aae..f4e89dded 100644 --- a/frontend/app/view/term.tsx +++ b/frontend/app/view/term.tsx @@ -180,6 +180,19 @@ const TerminalView = ({ blockId }: { blockId: string }) => { blockid: blockId, termsize: { rows: newTerm.rows, cols: newTerm.cols }, }); + connectElemRef.current.addEventListener( + "keydown", + (ev) => { + if (ev.code == "Escape" && ev.metaKey) { + ev.preventDefault(); + ev.stopPropagation(); + const metaCmd: BlockSetMetaCommand = { command: "setmeta", meta: { "term:mode": "html" } }; + services.BlockService.SendCommand(blockId, metaCmd); + return false; + } + }, + true + ); newTerm.onData((data) => { const b64data = btoa(data); const inputCmd: BlockInputCommand = { command: "controller:input", inputdata64: b64data };