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.
This commit is contained in:
David Lechner
2020-05-25 21:31:35 -05:00
committed by David Lechner
parent 2854ab422b
commit df34cd4ae5
+12
View File
@@ -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');
},
},
]}
/>
)}
</ReactReduxContext.Consumer>