Skip to content

Commit 422686e

Browse files
committed
✨ 添加快捷键设置:展开收起标签节点面板
1 parent aaf431c commit 422686e

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

app/src/components/IconButton.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ export default function IconButton({
66
children,
77
className = "",
88
onClick = () => {},
9+
id = "",
910
...props
1011
}: React.PropsWithChildren<{
1112
className?: string;
1213
onClick?: (e: React.MouseEvent) => void;
14+
id?: string;
1315
[key: string]: any;
1416
}>) {
1517
return (
@@ -19,6 +21,7 @@ export default function IconButton({
1921
className,
2022
)}
2123
onClick={onClick}
24+
id={id}
2225
{...props}
2326
>
2427
{children}

app/src/locales/zh_CN.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,3 +731,7 @@ keyBinds:
731731
description: |
732732
按下后,打开搜索框,可以输入搜索内容
733733
搜索框支持部分匹配,例如输入 "a" 能搜索到 "apple" 等
734+
clickTagPanelButton:
735+
title: 打开/关闭标签面板
736+
description: |
737+
按下此键可代替鼠标点击页面上的标签面板展开关闭按钮

app/src/main.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,23 @@ async function registerKeyBinds() {
487487
openBrowserOrFile();
488488
});
489489

490+
(
491+
await KeyBinds.create("clickTagPanelButton", "1", {
492+
control: false,
493+
alt: false,
494+
shift: false,
495+
})
496+
).down(() => {
497+
console.log("123");
498+
const button = document.getElementById("tagPanelBtn");
499+
const event = new MouseEvent("click", {
500+
bubbles: true,
501+
cancelable: true,
502+
view: window,
503+
});
504+
button?.dispatchEvent(event);
505+
});
506+
490507
const bind = await KeyBinds.create("keyboardOnlyGenerateNode", "tab", {
491508
control: false,
492509
alt: false,

app/src/pages/_app.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export default function App() {
6464
});
6565
}
6666
});
67+
6768
// 修复鼠标拖出窗口后触发上下文菜单的问题
6869
window.addEventListener("contextmenu", (event) => {
6970
if (
@@ -281,6 +282,7 @@ export default function App() {
281282
</IconButton>
282283

283284
<IconButton
285+
id="tagPanelBtn"
284286
onClick={(e) => {
285287
e.stopPropagation();
286288
setIsTagPanelOpen(!isTagPanelOpen);

0 commit comments

Comments
 (0)