Skip to content

Commit

Permalink
Bugfix / control-a hot key fix (#336)
Browse files Browse the repository at this point in the history
* disable shortcut key propogation

* update WA tool

---------

Co-authored-by: PhotoNomad0 <[email protected]>
  • Loading branch information
PhotoNomad0 and PhotoNomad0 authored Dec 23, 2024
1 parent d1fedd0 commit 76ead65
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 17 deletions.
40 changes: 32 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 14 additions & 8 deletions src/components/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const isMacOS = (os === 'mac');
// Define key combinations based on the operating system
const keyMap = {
REFRESH: os === 'mac' ? 'command+f' : 'ctrl+f',
ACCEPT: os === 'mac' ? 'command+a' : 'ctrl+a',
ACCEPT: os === 'mac' ? 'command+e' : 'ctrl+e',
REJECT: os === 'mac' ? 'command+j' : 'ctrl+j',
CLEAR: os === 'mac' ? 'command+k' : 'ctrl+k',
COMPLETE: os === 'mac' ? 'command+t' : 'ctrl+t',
Expand Down Expand Up @@ -787,38 +787,44 @@ export class Container extends Component {
}

const handlers = {
REFRESH: () => {
REFRESH: (e) => {
// console.log('F - Refresh action triggered')
this.handleRefreshSuggestions()
e.stopPropagation()
},
ACCEPT: () => {
// console.log('A - Accept action triggered')
ACCEPT: (e) => {
// console.log('E - Accept action triggered')
if (this.getHasRenderedSuggestions()) {
this.handleAcceptSuggestions()
} else {
// console.log('No suggestions')
}
e.stopPropagation()
},
REJECT: () => {
REJECT: (e) => {
// console.log('J - Reject action triggered')
if (this.getHasRenderedSuggestions()) {
this.handleRejectSuggestions()
} else {
// console.log('No suggestions')
}
e.stopPropagation()
},
CLEAR: () => {
CLEAR: (e) => {
// console.log('K - Clear action triggered')
this.handleClearAlignments()
e.stopPropagation()
},
COMPLETE: () => {
COMPLETE: (e) => {
// console.log('T - Complete action triggered')
this.handleToggleComplete(null, false, true) // toggle complete
e.stopPropagation()
},
NEXT: () => {
NEXT: (e) => {
// console.log('N - Next action triggered, contextId', contextId)
const { changeToNextContextId } = this.props;
changeToNextContextId()
e.stopPropagation()
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/MAPControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const getShortcutTable = (translate, isMacOS) => {
const functionKey = isMacOS ? 'Command' : 'Ctrl';
const shortcuts = [
{ action: 'suggestions.refresh_suggestions', shortcut: functionKey + '+F' },
{ action: 'suggestions.accept_suggestions', shortcut: functionKey + '+A' },
{ action: 'suggestions.accept_suggestions', shortcut: functionKey + '+E' },
{ action: 'suggestions.reject_suggestions', shortcut: functionKey + '+J' },
{ action: 'suggestions.clear_suggestions', shortcut: functionKey + '+K' },
{ action: 'toggle_alignment_complete', shortcut: functionKey + '+T' },
Expand Down

0 comments on commit 76ead65

Please sign in to comment.