From 36ecfc6ea4ca8c8436be97ff66255830ec277ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E4=B8=AB=E8=AE=B2=E6=A2=B5?= Date: Thu, 1 Oct 2026 23:51:00 +0800 Subject: [PATCH] feat(settings): support collapsing shortcut groups --- .../editor/EditorSettingsDialog.vue | 248 ++++++++++++------ ...og.shortcutScopeGroups.integration.spec.ts | 62 ++++- apps/desktop/src/i18n/locales/az.ts | 2 + apps/desktop/src/i18n/locales/en.ts | 2 + apps/desktop/src/i18n/locales/es.ts | 2 + apps/desktop/src/i18n/locales/it.ts | 2 + apps/desktop/src/i18n/locales/ja.ts | 2 + apps/desktop/src/i18n/locales/ko.ts | 2 + apps/desktop/src/i18n/locales/pt-BR.ts | 2 + apps/desktop/src/i18n/locales/ru.ts | 2 + apps/desktop/src/i18n/locales/tr.ts | 2 + apps/desktop/src/i18n/locales/zh-CN.ts | 2 + apps/desktop/src/i18n/locales/zh-TW.ts | 2 + 13 files changed, 256 insertions(+), 76 deletions(-) diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue index 2d0f8ff117..3c761d4ccd 100644 --- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue +++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue @@ -2076,6 +2076,7 @@ const crossScopeShortcutPairCount = computed(() => countShortcutConflictPairs(cr const sqlShortcutConflicts = computed(() => findSqlShortcutConflicts(editSqlShortcuts.value, editShortcuts.value)); const hasSqlShortcutConflicts = computed(() => sqlShortcutConflicts.value.length > 0); const shortcutSearchQuery = ref(""); +const collapsedShortcutScopes = ref>(new Set()); const formatterEditorShortcutIds: ShortcutActionId[] = [ "formatSql", "toggleLineComment", @@ -2165,6 +2166,24 @@ const shortcutScopeGroups = computed(() => }).filter((group) => group.definitions.length > 0), ); +function shortcutScopeContentId(scope: ShortcutScope): string { + return `shortcut-scope-content-${scope}`; +} + +function isShortcutScopeExpanded(group: ShortcutScopeGroup): boolean { + // Keep manually collapsed groups visible while searching so matching rows + // cannot be hidden. The Set itself is left untouched, so clearing search + // restores the user's previous collapsed state. + return shortcutSearchQuery.value.trim().length > 0 || !collapsedShortcutScopes.value.has(group.scope); +} + +function toggleShortcutScope(scope: ShortcutScope) { + const next = new Set(collapsedShortcutScopes.value); + if (next.has(scope)) next.delete(scope); + else next.add(scope); + collapsedShortcutScopes.value = next; +} + function isShortcutModified(definition: ShortcutDefinition): boolean { return editShortcuts.value[definition.id] !== definition.defaultShortcut; } @@ -9056,7 +9075,17 @@ onUnmounted(() => { 圆角改由组头(上)与末行(下)分别承担。 -->
-
+
-
-
-
- - - - - {{ t("settings.shortcutModifiedTag") }} - - -
-
-
-
- - - - - - - - -