Skip to content

Commit

Permalink
feat: 支持按下 home 键回到顶部 (#620)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayangweb authored Oct 5, 2024
1 parent a96d3a0 commit 985f23b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pages/Clipboard/Panel/components/List/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const List = () => {
}, [state.list.length]);

useOSKeyPress(
["space", "enter", "backspace", "uparrow", "downarrow"],
["space", "enter", "backspace", "uparrow", "downarrow", "home"],
(_, key) => {
state.eventBusId = state.activeId;

Expand All @@ -72,6 +72,9 @@ const List = () => {
// 选中下一个
case "downarrow":
return state.$eventBus?.emit(LISTEN_KEY.CLIPBOARD_ITEM_SELECT_NEXT);
// 回到顶部
case "home":
return rowVirtualizer.scrollToIndex?.(0);
}
},
{
Expand Down

0 comments on commit 985f23b

Please sign in to comment.