✨ feat(shortcuts): 添加打开设置的键盘快捷键
新增 openSettings 快捷键,默认绑定 Mod+,,用于触发设置对话框。 包含所有语言包的翻译、键盘快捷键文档更新,以及测试用例。
This commit is contained in:
13 files changed
+46
No files matched your search
@@ -47,6 +47,7 @@ import {
|
||||
isModRShortcut,
|
||||
isNewQueryShortcut,
|
||||
isObjectSourceSaveShortcutTarget,
|
||||
isOpenSettingsShortcut,
|
||||
isResetZoomShortcut,
|
||||
isRefreshDataShortcut,
|
||||
isSaveShortcut,
|
||||
@@ -760,6 +761,12 @@ function handleKeydown(e: KeyboardEvent) {
|
||||
|
||||
const shortcuts = settingsStore.editorSettings.shortcuts;
|
||||
|
||||
if (isOpenSettingsShortcut(e, shortcuts)) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
showSettingsDialog.value = true;
|
||||
return;
|
||||
}
|
||||
if (isFocusSearchShortcut(e, shortcuts)) {
|
||||
const focused = contentAreaRef.value?.focusSearch() || appSidebarRef.value?.focusSearch();
|
||||
if (focused) {
|
||||
|
||||
@@ -1863,6 +1863,7 @@ export default {
|
||||
shortcutCopyCurrentRow: "Copy current data row",
|
||||
shortcutDeleteCurrentRow: "Delete current data row",
|
||||
shortcutNewQuery: "New query",
|
||||
shortcutOpenSettings: "Open settings",
|
||||
shortcutCloseTab: "Close tab",
|
||||
shortcutFocusSearch: "Focus search",
|
||||
shortcutZoomInUi: "Zoom in UI",
|
||||
|
||||
@@ -1653,6 +1653,7 @@ export default {
|
||||
shortcutCopyCurrentRow: "Copiar fila de datos actual",
|
||||
shortcutDeleteCurrentRow: "Eliminar fila de datos actual",
|
||||
shortcutNewQuery: "Nueva consulta",
|
||||
shortcutOpenSettings: "Abrir configuración",
|
||||
shortcutCloseTab: "Cerrar pestaña",
|
||||
shortcutFocusSearch: "Enfocar búsqueda",
|
||||
shortcutZoomInUi: "Ampliar interfaz",
|
||||
|
||||
@@ -1799,6 +1799,7 @@ export default {
|
||||
shortcutCopyCurrentRow: "Copia riga dati corrente",
|
||||
shortcutDeleteCurrentRow: "Elimina riga dati corrente",
|
||||
shortcutNewQuery: "Nuova query",
|
||||
shortcutOpenSettings: "Apri impostazioni",
|
||||
shortcutCloseTab: "Chiudi scheda",
|
||||
shortcutFocusSearch: "Focalizza ricerca",
|
||||
shortcutZoomInUi: "Ingrandisci UI",
|
||||
|
||||
@@ -1788,6 +1788,7 @@ export default {
|
||||
shortcutCopyCurrentRow: "Copiar linha de dados atual",
|
||||
shortcutDeleteCurrentRow: "Excluir linha de dados atual",
|
||||
shortcutNewQuery: "Nova consulta",
|
||||
shortcutOpenSettings: "Abrir configurações",
|
||||
shortcutCloseTab: "Fechar aba",
|
||||
shortcutFocusSearch: "Focar na pesquisa",
|
||||
shortcutZoomInUi: "Aumentar zoom da UI",
|
||||
|
||||
@@ -1816,6 +1816,7 @@ export default {
|
||||
shortcutCopyCurrentRow: "复制当前数据行",
|
||||
shortcutDeleteCurrentRow: "删除当前数据行",
|
||||
shortcutNewQuery: "新建查询",
|
||||
shortcutOpenSettings: "打开设置",
|
||||
shortcutCloseTab: "关闭标签页",
|
||||
shortcutFocusSearch: "聚焦搜索",
|
||||
shortcutZoomInUi: "放大全局界面",
|
||||
|
||||
@@ -1692,6 +1692,7 @@ export default {
|
||||
shortcutCopyCurrentRow: "複製目前資料列",
|
||||
shortcutDeleteCurrentRow: "刪除目前資料列",
|
||||
shortcutNewQuery: "建立查詢",
|
||||
shortcutOpenSettings: "開啟設定",
|
||||
shortcutCloseTab: "關閉分頁",
|
||||
shortcutFocusSearch: "聚焦搜尋",
|
||||
shortcutZoomInUi: "放大全域介面",
|
||||
|
||||
@@ -80,6 +80,10 @@ export function isNewQueryShortcut(event: ShortcutLikeEvent, shortcuts?: Partial
|
||||
return matchesShortcut(event, actionShortcut("newQuery", shortcuts));
|
||||
}
|
||||
|
||||
export function isOpenSettingsShortcut(event: ShortcutLikeEvent, shortcuts?: Partial<ShortcutSettings>): boolean {
|
||||
return matchesShortcut(event, actionShortcut("openSettings", shortcuts));
|
||||
}
|
||||
|
||||
export function isFocusSearchShortcut(event: ShortcutLikeEvent, shortcuts?: Partial<ShortcutSettings>): boolean {
|
||||
return matchesShortcut(event, actionShortcut("focusSearch", shortcuts));
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ export type ShortcutActionId =
|
||||
| "copyCurrentRow"
|
||||
| "deleteCurrentRow"
|
||||
| "newQuery"
|
||||
| "openSettings"
|
||||
| "closeTab"
|
||||
| "focusSearch"
|
||||
| "zoomInUi"
|
||||
@@ -64,6 +65,12 @@ export const SHORTCUT_DEFINITIONS: ShortcutDefinition[] = [
|
||||
scope: "global",
|
||||
defaultShortcut: "Mod+T",
|
||||
},
|
||||
{
|
||||
id: "openSettings",
|
||||
labelKey: "settings.shortcutOpenSettings",
|
||||
scope: "global",
|
||||
defaultShortcut: "Mod+,",
|
||||
},
|
||||
{
|
||||
id: "closeTab",
|
||||
labelKey: "settings.shortcutCloseTab",
|
||||
|
||||
Reference in new issue
Block a user