-
Notifications
You must be signed in to change notification settings - Fork 52
chore(TabBar): 优化 TabBar 关闭按钮 hover 样式 #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,8 +1,8 @@ | ||||||||||||||||||||
| <script setup lang="ts"> | ||||||||||||||||||||
| import { onMounted, onUnmounted, ref } from 'vue' | ||||||||||||||||||||
| import { vDraggable } from 'vue-draggable-plus' | ||||||||||||||||||||
| import useFile from '@/renderer/hooks/useFile' | ||||||||||||||||||||
| import useTab from '@/renderer/hooks/useTab' | ||||||||||||||||||||
| import { onMounted, onUnmounted, ref } from "vue"; | ||||||||||||||||||||
| import { vDraggable } from "vue-draggable-plus"; | ||||||||||||||||||||
| import useFile from "@/renderer/hooks/useFile"; | ||||||||||||||||||||
| import useTab from "@/renderer/hooks/useTab"; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| const { | ||||||||||||||||||||
| formattedTabs, | ||||||||||||||||||||
|
|
@@ -14,99 +14,111 @@ const { | |||||||||||||||||||
| setupTabScrollListener, | ||||||||||||||||||||
| cleanupInertiaScroll, | ||||||||||||||||||||
| reorderTabs, | ||||||||||||||||||||
| } = useTab() | ||||||||||||||||||||
| } = useTab(); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| const { createNewFile } = useFile() | ||||||||||||||||||||
| const { createNewFile } = useFile(); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // 拦截 ctrl/cmd + w 快捷键关闭tab | ||||||||||||||||||||
| function handleCloseTabShortcut(e: KeyboardEvent) { | ||||||||||||||||||||
| const isMac = window.electronAPI.platform === 'darwin' | ||||||||||||||||||||
| if ((isMac ? e.metaKey : e.ctrlKey) && e.key.toLowerCase() === 'w') { | ||||||||||||||||||||
| e.preventDefault() | ||||||||||||||||||||
| const isMac = window.electronAPI.platform === "darwin"; | ||||||||||||||||||||
| if ((isMac ? e.metaKey : e.ctrlKey) && e.key.toLowerCase() === "w") { | ||||||||||||||||||||
| e.preventDefault(); | ||||||||||||||||||||
| if (activeTabId.value) { | ||||||||||||||||||||
| closeWithConfirm(activeTabId.value) | ||||||||||||||||||||
| closeWithConfirm(activeTabId.value); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
| window.addEventListener('keydown', handleCloseTabShortcut) | ||||||||||||||||||||
| window.addEventListener("keydown", handleCloseTabShortcut); | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
Comment on lines
+31
to
32
|
||||||||||||||||||||
| window.addEventListener("keydown", handleCloseTabShortcut); | |
| onMounted(() => { | |
| window.addEventListener("keydown", handleCloseTabShortcut); | |
| }); | |
| onUnmounted(() => { | |
| window.removeEventListener("keydown", handleCloseTabShortcut); | |
| }); |
Copilot
AI
Feb 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleCloseTab is marked async but doesn't await anything. This returns a Promise unnecessarily and can be misleading; consider removing async (or await the confirm/close call if it is actually asynchronous).
| async function handleCloseTab(id: string, event: Event) { | |
| function handleCloseTab(id: string, event: Event) { |
Copilot
AI
Feb 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.closeIcon:hover span { color: var(--text-color-1) } is effectively overridden when the tab is hovered because the later &:hover .closeIcon span { color: var(--text-color-2) } selector is more specific and appears later in the file. If the intent is to change the close icon color on close-button hover, increase selector specificity (e.g. &:hover .closeIcon:hover span) and/or move the override after the tab hover block so it wins in the cascade.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is described as a hover-style tweak, but the script section also introduces broad non-functional reformatting (quote style + semicolons). Consider reverting unrelated formatting-only changes so the diff stays focused and easier to review/blame in the future.