mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-18 06:22:28 +03:00
small fixes for nav handling
This commit is contained in:
parent
29a87b7efe
commit
4815b57b95
@ -25,6 +25,13 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
let selection = [0, 0] as [number, number];
|
let selection = [0, 0] as [number, number];
|
||||||
|
commandGroups.subscribe((groups) => {
|
||||||
|
const newGroupIndex = Math.min(selection[0], groups.length - 1);
|
||||||
|
Promise.resolve(groups[newGroupIndex]).then((group) => {
|
||||||
|
const newCommandIndex = Math.min(selection[1], group.commands.length - 1);
|
||||||
|
selection = [newGroupIndex, newCommandIndex];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const selectNextCommand = () => {
|
const selectNextCommand = () => {
|
||||||
if (!modal?.isOpen()) return;
|
if (!modal?.isOpen()) return;
|
||||||
@ -103,7 +110,9 @@
|
|||||||
if (command.hotkey) {
|
if (command.hotkey) {
|
||||||
unregisterCommandHotkeys.push(
|
unregisterCommandHotkeys.push(
|
||||||
tinykeys(window, {
|
tinykeys(window, {
|
||||||
[command.hotkey]: () => {
|
[command.hotkey]: (event: KeyboardEvent) => {
|
||||||
|
const target = event.target as HTMLElement;
|
||||||
|
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') return;
|
||||||
// only trigger if the modal is visible
|
// only trigger if the modal is visible
|
||||||
modal?.isOpen() && trigger(command.action);
|
modal?.isOpen() && trigger(command.action);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user