mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-21 16:55:25 +03:00
Fix keyboard shortcuts leaked to multi-column mode
This commit is contained in:
parent
f236ec5ab9
commit
f0773dc6f3
1 changed files with 18 additions and 12 deletions
|
@ -30,10 +30,10 @@ function Shortcuts() {
|
|||
if (!shortcuts.length) {
|
||||
return null;
|
||||
}
|
||||
if (
|
||||
const isMultiColumnMode =
|
||||
settings.shortcutsViewMode === 'multi-column' ||
|
||||
(!settings.shortcutsViewMode && settings.shortcutsColumnsMode)
|
||||
) {
|
||||
(!settings.shortcutsViewMode && settings.shortcutsColumnsMode);
|
||||
if (isMultiColumnMode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -87,16 +87,22 @@ function Shortcuts() {
|
|||
.filter(Boolean);
|
||||
|
||||
const navigate = useNavigate();
|
||||
useHotkeys(['1', '2', '3', '4', '5', '6', '7', '8', '9'], (e, handler) => {
|
||||
const index = parseInt(handler.keys[0], 10) - 1;
|
||||
if (index < formattedShortcuts.length) {
|
||||
const { path } = formattedShortcuts[index];
|
||||
if (path) {
|
||||
navigate(path);
|
||||
menuRef.current?.closeMenu?.();
|
||||
useHotkeys(
|
||||
['1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
(e, handler) => {
|
||||
const index = parseInt(handler.keys[0], 10) - 1;
|
||||
if (index < formattedShortcuts.length) {
|
||||
const { path } = formattedShortcuts[index];
|
||||
if (path) {
|
||||
navigate(path);
|
||||
menuRef.current?.closeMenu?.();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
{
|
||||
enabled: !isMultiColumnMode,
|
||||
},
|
||||
);
|
||||
|
||||
const [lists, setLists] = useState([]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue