Cmd-ESC now toggles both ways

This commit is contained in:
sawka 2024-06-14 00:15:09 -07:00
parent 8e3540f754
commit b7b813a4a7

View File

@ -180,6 +180,19 @@ const TerminalView = ({ blockId }: { blockId: string }) => {
blockid: blockId, blockid: blockId,
termsize: { rows: newTerm.rows, cols: newTerm.cols }, 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) => { newTerm.onData((data) => {
const b64data = btoa(data); const b64data = btoa(data);
const inputCmd: BlockInputCommand = { command: "controller:input", inputdata64: b64data }; const inputCmd: BlockInputCommand = { command: "controller:input", inputdata64: b64data };