This commit is contained in:
Baobhan Sith
2025-05-23 21:18:28 +08:00
parent ac519b8c8f
commit 40653309ec
2 changed files with 8 additions and 5 deletions
+4 -2
View File
@@ -109,8 +109,9 @@ const closeStyleCustomizer = () => {
appearanceStore.toggleStyleCustomizer(false);
};
// +++ 修改:处理 Alt 键按下的事件处理函数,并记录快捷键 +++
// +++ 处理 Alt 键按下的事件处理函数,并记录快捷键 +++
const handleAltKeyDown = async (event: KeyboardEvent) => { // +++ 改为 async +++
if (!isWorkspaceRoute.value) return; // 只在 workspace 路由下执行
// 只在 Alt 键首次按下时设置状态
if (event.key === 'Alt' && !event.repeat) {
isAltPressed.value = true;
@@ -161,8 +162,9 @@ const handleAltKeyDown = async (event: KeyboardEvent) => { // +++ 改为 async +
}
};
// +++ 修改:全局键盘事件处理函数,监听 keyup,优先处理快捷键 +++
// +++ 全局键盘事件处理函数,监听 keyup,优先处理快捷键 +++
const handleGlobalKeyUp = async (event: KeyboardEvent) => {
if (!isWorkspaceRoute.value) return; // 只在 workspace 路由下执行
if (event.key === 'Alt') {
const altWasPressed = isAltPressed.value;
const triggeredShortcutKey = altShortcutKey.value; // 记录松开时是否有记录的快捷键
@@ -1703,7 +1703,7 @@ const handleOpenEditorClick = () => {
<div class="flex flex-col h-full overflow-hidden bg-background text-foreground text-sm font-sans">
<div class="flex items-center justify-between flex-wrap gap-2 p-2 bg-header flex-shrink-0">
<!-- Wrapper for Path Actions and Path Bar -->
<div class="flex items-center gap-2 flex-shrink"> <!-- Added gap-2 -->
<div class="flex items-center gap-2 flex-grow min-w-0"> <!-- Added gap-2, flex-grow, min-w-0 -->
<!-- Path Actions -->
<div class="flex items-center flex-shrink-0"> <!-- Removed mr-auto -->
<!-- CD 到终端按钮 -->
@@ -1784,8 +1784,9 @@ const handleOpenEditorClick = () => {
<div ref="pathInputWrapperRef" class="relative flex items-center bg-background border border-border rounded px-1.5 py-0.5 w-fit flex-shrink">
<span v-show="!isEditingPath && !showPathHistoryDropdown" @click="startPathEdit" class="text-text-secondary whitespace-nowrap overflow-x-auto pr-2 cursor-text">
<div ref="pathInputWrapperRef" class="relative flex items-center bg-background border border-border rounded px-1.5 py-0.5"
:class="{ 'flex-grow min-w-0': isEditingPath || showPathHistoryDropdown, 'w-fit max-w-full': !isEditingPath && !showPathHistoryDropdown }">
<span v-show="!isEditingPath && !showPathHistoryDropdown" @click="startPathEdit" class="text-text-secondary pr-2 cursor-text truncate">
<strong
:title="t('fileManager.editPathTooltip')"
class="font-medium text-link px-1 rounded transition-colors duration-200"