Skip to content

Commit

Permalink
feat: added monaco keybindings for selection history navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
devcatalin committed Aug 19, 2021
1 parent 572567b commit 3626327
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/components/molecules/Monaco/Monaco.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import YamlWorker from 'worker-loader!monaco-yaml/lib/esm/yaml.worker';
import {getResourceSchema} from '@redux/services/schema';
import {logMessage} from '@redux/services/log';
import {updateFileEntry, updateResource, selectK8sResource} from '@redux/reducers/main';
import {selectFromHistory} from '@redux/thunks/selectionHistory';
import {parseAllDocuments} from 'yaml';
import {ROOT_FILE_ENTRY} from '@constants/constants';
import {KUBESHOP_MONACO_THEME} from '@utils/monaco';
Expand Down Expand Up @@ -124,6 +125,28 @@ const Monaco = (props: {editorHeight: string}) => {
},
});

// register action to navigate back in the selection history
e.addAction({
id: 'monokle-navigate-back',
label: 'Navigate Back',
/* eslint-disable no-bitwise */
keybindings: [monaco.KeyMod.Alt | monaco.KeyCode.LeftArrow],
run: () => {
dispatch(selectFromHistory({direction: 'left'}));
},
});

// register action to navigate forward in the selection history
e.addAction({
id: 'monokle-navigate-forward',
label: 'Navigate Forward',
/* eslint-disable no-bitwise */
keybindings: [monaco.KeyMod.Alt | monaco.KeyCode.RightArrow],
run: () => {
dispatch(selectFromHistory({direction: 'right'}));
},
});

editorRef.current = e as monaco.editor.IStandaloneCodeEditor;

// @ts-ignore
Expand Down

0 comments on commit 3626327

Please sign in to comment.