Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

feat(nacos): 增强配置编辑器支持文本选择和 Tab 按键

二丫讲梵59590f2a15ca
diff --git a/apps/desktop/src/components/nacos/NacosAdminConsole.vue b/apps/desktop/src/components/nacos/NacosAdminConsole.vue
index 07a2fa36be..faf8489b3f 100644
--- a/apps/desktop/src/components/nacos/NacosAdminConsole.vue
+++ b/apps/desktop/src/components/nacos/NacosAdminConsole.vue
@@ -17,6 +17,7 @@ import { useI18n } from "vue-i18n";
import * as api from "@/lib/api";
import { buildNacosConfigDeleteConfirm, buildNacosConfigExportFileName, buildNacosConfigHistoryRollbackConfirm, buildNacosInstanceConfirm, createNacosSaveAsCopy, resolveNacosConfigCopyText } from "@/lib/nacosAdmin";
import { copyToClipboard, readTextFromClipboard } from "@/lib/clipboard";
+import { trimmedSelectionLayer } from "@/lib/codemirrorTrimmedSelectionLayer";
import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/safeStorage";
import { editorFontTheme, loadEditorTheme } from "@/lib/editorThemes";
import { isTauriRuntime } from "@/lib/tauriRuntime";
@@ -178,7 +179,7 @@ async function configLanguageExtension(format: string): Promise<Extension[]> {
async function mountConfigEditor() {
await nextTick();
if (!configEditorHost.value || configEditorView.value || !selectedConfig.value) return;
- const [{ EditorState, Prec }, { EditorView, keymap }, { basicSetup }, { defaultKeymap, historyKeymap }, { search: cmSearch }, language] = await Promise.all([
+ const [{ EditorState, Prec }, { EditorView, keymap }, { basicSetup }, { defaultKeymap, historyKeymap, indentWithTab }, { search: cmSearch }, language] = await Promise.all([
import("@codemirror/state"),
import("@codemirror/view"),
import("codemirror"),
@@ -202,17 +203,14 @@ async function mountConfigEditor() {
},
}),
basicSetup,
- Prec.highest(
- keymap.of([
- { key: "Mod-f", run: () => configSearchPanelRef.value?.openSearch() ?? false, preventDefault: true },
- { key: "Mod-h", run: () => configSearchPanelRef.value?.openReplace() ?? false, preventDefault: true },
- ]),
- ),
+ trimmedSelectionLayer(),
+ Prec.highest(keymap.of([{ key: "Mod-f", run: () => configSearchPanelRef.value?.openSearch() ?? false, preventDefault: true }, { key: "Mod-h", run: () => configSearchPanelRef.value?.openReplace() ?? false, preventDefault: true }, indentWithTab])),
keymap.of([...defaultKeymap, ...historyKeymap]),
configEditorLanguage.of(language),
configEditorTheme.of(theme),
configEditorFontTheme.of(editorFontTheme(EditorView, editorSettings.fontSize, editorSettings.fontFamily, { fixedHeight: true, scrollable: true })),
EditorView.lineWrapping,
+ EditorState.readOnly.of(!!props.readOnly),
EditorView.editable.of(!props.readOnly),
EditorView.updateListener.of((update) => {
if (!update.docChanged) return;
@@ -228,6 +226,8 @@ async function mountConfigEditor() {
},
".cm-content": {
minHeight: "100%",
+ userSelect: "text",
+ WebkitUserSelect: "text",
},
".cm-lineNumbers .cm-gutterElement": {
padding: "0 10px 0 8px",