diff --git a/lib/note-content-editor.tsx b/lib/note-content-editor.tsx index 45d4d2868..7f9b9128e 100644 --- a/lib/note-content-editor.tsx +++ b/lib/note-content-editor.tsx @@ -158,6 +158,20 @@ class NoteContentEditor extends Component { window.monaco = monaco; this.editor = editor; + window.electron.receive('appCommand', (command) => { + switch (command.action) { + case 'redo': + editor.trigger('', 'redo'); + return; + case 'selectAll': + editor.setSelection(editor.getModel().getFullModelRange()); + return; + case 'undo': + editor.trigger('', 'undo'); + return; + } + }); + const titleDecoration = (line: number) => ({ range: new monaco.Range(line, 1, line, 1), options: { diff --git a/lib/state/electron/middleware.ts b/lib/state/electron/middleware.ts index a5d3ff921..72e4861c0 100644 --- a/lib/state/electron/middleware.ts +++ b/lib/state/electron/middleware.ts @@ -25,20 +25,10 @@ export const middleware: S.Middleware = ({ dispatch, getState }) => { dispatch({ type: 'INSERT_TASK' }); return; - case 'redo': - window?.editor.trigger('', 'redo'); - return; - case 'showDialog': dispatch(actions.ui.showDialog(command.dialog)); return; - case 'selectAll': - window?.editor.setSelection( - window?.editor.getModel().getFullModelRange() - ); - return; - case 'trashNote': dispatch(actions.ui.trashOpenNote()); return; @@ -87,10 +77,6 @@ export const middleware: S.Middleware = ({ dispatch, getState }) => { dispatch(actions.settings.toggleSpellCheck()); return; - case 'undo': - window?.editor.trigger('', 'undo'); - return; - default: console.log(command); }