From df34cd4ae5e4a45a6bc22b8307e564c2795ab8b1 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 25 May 2020 11:28:00 -0500 Subject: [PATCH] Ignore CTRL+S in editor Some programmers have the habbit of always pressing CTRL+S which opens the browsers save as dialog and interrupts workflow. We already automatically save the current file, so we can just ignore they keypress. --- src/components/Editor.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/Editor.tsx b/src/components/Editor.tsx index 2de32c4b..65cbb87d 100644 --- a/src/components/Editor.tsx +++ b/src/components/Editor.tsx @@ -33,6 +33,18 @@ class Editor extends React.Component { store.dispatch(setEditSession(e?.session)); }} onChange={(v): void => localStorage.setItem('program', v)} + commands={[ + { + name: 'save', + bindKey: { win: 'Ctrl-S', mac: 'Cmd-S' }, + exec: (): void => { + // We already automatically save the file + // to local storage after every change, so + // CTRL+S is ignored + console.debug('CTRL+S ignored'); + }, + }, + ]} /> )}