mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-24 09:38:29 +02:00
Fix zoom hotkey
https://feedback.yaak.app/p/zoom-in-not-working-on-linux-mint
This commit is contained in:
@@ -35,7 +35,7 @@ export type HotkeyAction =
|
|||||||
| 'workspace_settings.show';
|
| 'workspace_settings.show';
|
||||||
|
|
||||||
const hotkeys: Record<HotkeyAction, string[]> = {
|
const hotkeys: Record<HotkeyAction, string[]> = {
|
||||||
'app.zoom_in': ['CmdCtrl+Plus'],
|
'app.zoom_in': ['CmdCtrl+Equal'],
|
||||||
'app.zoom_out': ['CmdCtrl+Minus'],
|
'app.zoom_out': ['CmdCtrl+Minus'],
|
||||||
'app.zoom_reset': ['CmdCtrl+0'],
|
'app.zoom_reset': ['CmdCtrl+0'],
|
||||||
'command_palette.toggle': ['CmdCtrl+k'],
|
'command_palette.toggle': ['CmdCtrl+k'],
|
||||||
@@ -50,7 +50,7 @@ const hotkeys: Record<HotkeyAction, string[]> = {
|
|||||||
'switcher.toggle': ['CmdCtrl+p'],
|
'switcher.toggle': ['CmdCtrl+p'],
|
||||||
'settings.show': ['CmdCtrl+,'],
|
'settings.show': ['CmdCtrl+,'],
|
||||||
'sidebar.filter': ['CmdCtrl+f'],
|
'sidebar.filter': ['CmdCtrl+f'],
|
||||||
'sidebar.expand_all': ['CmdCtrl+Shift+Plus'],
|
'sidebar.expand_all': ['CmdCtrl+Shift+Equal'],
|
||||||
'sidebar.collapse_all': ['CmdCtrl+Shift+Minus'],
|
'sidebar.collapse_all': ['CmdCtrl+Shift+Minus'],
|
||||||
'sidebar.selected.delete': ['Delete', 'CmdCtrl+Backspace'],
|
'sidebar.selected.delete': ['Delete', 'CmdCtrl+Backspace'],
|
||||||
'sidebar.selected.duplicate': ['CmdCtrl+d'],
|
'sidebar.selected.duplicate': ['CmdCtrl+d'],
|
||||||
@@ -190,7 +190,7 @@ function handleKeyDown(e: KeyboardEvent) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't support certain single-key combinrations within inputs
|
// Don't support certain single-key combinations within inputs
|
||||||
if (
|
if (
|
||||||
(e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) &&
|
(e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) &&
|
||||||
currentKeysWithModifiers.size === 1 &&
|
currentKeysWithModifiers.size === 1 &&
|
||||||
@@ -212,16 +212,7 @@ function handleKeyDown(e: KeyboardEvent) {
|
|||||||
|
|
||||||
for (const hkKey of hkKeys) {
|
for (const hkKey of hkKeys) {
|
||||||
const keys = hkKey.split('+');
|
const keys = hkKey.split('+');
|
||||||
const adjustedKeys = keys
|
const adjustedKeys = keys.map(resolveHotkeyKey);
|
||||||
.map((k) => {
|
|
||||||
// Special case for Plus
|
|
||||||
if (keys.includes('Shift') && k === 'Plus') {
|
|
||||||
return 'Equal';
|
|
||||||
} else {
|
|
||||||
return k;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.map(resolveHotkeyKey);
|
|
||||||
if (compareKeys(adjustedKeys, Array.from(currentKeysWithModifiers))) {
|
if (compareKeys(adjustedKeys, Array.from(currentKeysWithModifiers))) {
|
||||||
if (!options.allowDefault) {
|
if (!options.allowDefault) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
Reference in New Issue
Block a user