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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix: honor editor font in redis views
t8y2a68af9c740d4
diff --git a/apps/desktop/src/components/redis/RedisKeyBrowser.vue b/apps/desktop/src/components/redis/RedisKeyBrowser.vueindex 43075a418f..e83254b585 100644--- a/apps/desktop/src/components/redis/RedisKeyBrowser.vue+++ b/apps/desktop/src/components/redis/RedisKeyBrowser.vue@@ -41,10 +41,12 @@ import { classifyRedisCommandSafety } from "@/lib/redisCommandSafety";import { isRedisClearScreenCommand, nextRedisCommandDb, redisKeyTextToRaw } from "@/lib/redisCommandSession";import { formatRedisCommandResult, formatRedisStringValue } from "@/lib/redisValuePresentation";import { isCancelSearchShortcut } from "@/lib/keyboardShortcuts";+import { useEditorFontFamilyStyle } from "@/composables/useEditorFontFamilyStyle";const { t } = useI18n();const connectionStore = useConnectionStore();const settingsStore = useSettingsStore();+const editorFontFamilyStyle = useEditorFontFamilyStyle();type RedisSearchMode = "key" | "value";type RedisCreateKeyType = "string" | "hash" | "list" | "set" | "zset";@@ -577,7 +579,7 @@ defineExpose({ focusSearch });</script><template>- <div ref="rootRef" class="h-full">+ <div ref="rootRef" class="h-full" :style="editorFontFamilyStyle"><Splitpanes class="redis-workspace-splitpanes h-full"><!-- Key tree (left) --><Pane :size="36" :min-size="24">@@ -688,7 +690,7 @@ defineExpose({ focusSearch });:is="expandedGroupIds.has(row.node.id) ? FolderOpen : FolderClosed"class="w-3 h-3 shrink-0 text-amber-500"/>- <span class="truncate font-mono">{{ row.node.label }}</span>+ <span class="dbx-editor-font-family truncate">{{ row.node.label }}</span><span class="text-muted-foreground ml-1">({{ countLeaves(row.node) }})</span></template><template v-else>@@ -705,7 +707,7 @@ defineExpose({ focusSearch });@click="toggleCheck(row.node.keyRaw, $event)"/></span>- <span class="truncate font-mono">{{ row.node.label }}</span>+ <span class="dbx-editor-font-family truncate">{{ row.node.label }}</span></template></div>@@ -785,7 +787,7 @@ defineExpose({ focusSearch });<TabsContent value="command" class="m-0 min-h-0 flex-1 flex flex-col"><div- class="relative flex min-h-0 flex-1 flex-col bg-[#090c10] font-mono text-[13px] leading-5 text-slate-100"+ class="dbx-editor-font-family relative flex min-h-0 flex-1 flex-col bg-[#090c10] text-[13px] leading-5 text-slate-100"@click="getCommandInput()?.focus()"><div ref="commandTerminalRef" class="min-h-0 flex-1 overflow-auto px-4 pb-3 pt-4">@@ -815,7 +817,7 @@ defineExpose({ focusSearch });<inputv-model="commandText"data-redis-command-input- class="min-w-0 flex-1 border-0 bg-transparent p-0 font-mono text-[13px] text-slate-100 caret-[#d7ba7d] outline-none placeholder:text-slate-600"+ class="dbx-editor-font-family min-w-0 flex-1 border-0 bg-transparent p-0 text-[13px] text-slate-100 caret-[#d7ba7d] outline-none placeholder:text-slate-600":disabled="commandRunning"autocomplete="off"autocapitalize="off"@@ -840,7 +842,7 @@ defineExpose({ focusSearch });/><Dialog v-model:open="showCreateKeyDialog">- <DialogContent class="sm:max-w-md">+ <DialogContent class="sm:max-w-md" :style="editorFontFamilyStyle"><DialogHeader><DialogTitle>{{ t("redis.createKey") }}</DialogTitle></DialogHeader>@@ -850,7 +852,7 @@ defineExpose({ focusSearch });<span>{{ t("redis.createKeyName") }}</span><Inputv-model="createKeyName"- class="h-8 font-mono text-xs"+ class="dbx-editor-font-family h-8 text-xs":placeholder="t('redis.createKeyNamePlaceholder')"@keydown.enter="createRedisKey"/>@@ -877,7 +879,7 @@ defineExpose({ focusSearch });<span>{{ t("redis.createField") }}</span><Inputv-model="createKeyField"- class="h-8 font-mono text-xs"+ class="dbx-editor-font-family h-8 text-xs":placeholder="t('redis.createFieldPlaceholder')"@keydown.enter="createRedisKey"/>@@ -887,7 +889,7 @@ defineExpose({ focusSearch });<span>{{ t("redis.createScore") }}</span><Inputv-model="createKeyScore"- class="h-8 font-mono text-xs"+ class="dbx-editor-font-family h-8 text-xs"placeholder="0"@keydown.enter="createRedisKey"/>@@ -899,7 +901,7 @@ defineExpose({ focusSearch });}}</span><textareav-model="createKeyValue"- class="min-h-28 resize-y rounded-md border bg-background p-2 font-mono text-xs outline-none focus-visible:ring-1 focus-visible:ring-ring"+ class="dbx-editor-font-family min-h-28 resize-y rounded-md border bg-background p-2 text-xs outline-none focus-visible:ring-1 focus-visible:ring-ring"spellcheck="false":placeholder="t('redis.createValuePlaceholder')"/>diff --git a/apps/desktop/src/components/redis/RedisValueViewer.vue b/apps/desktop/src/components/redis/RedisValueViewer.vueindex 7f7058abe1..25d7d56ab9 100644--- a/apps/desktop/src/components/redis/RedisValueViewer.vue+++ b/apps/desktop/src/components/redis/RedisValueViewer.vue@@ -14,6 +14,7 @@ import * as api from "@/lib/api";import type { RedisKeyInfo, RedisValue } from "@/lib/api";import { useToast } from "@/composables/useToast";import { useTheme } from "@/composables/useTheme";+import { useEditorFontFamilyStyle } from "@/composables/useEditorFontFamilyStyle";import { createRedisShikiJsonHighlighter, type RedisJsonHighlighter } from "@/lib/redisJsonHighlighter";import { copyToClipboard } from "@/lib/clipboard";import {@@ -26,6 +27,7 @@ import {const { t } = useI18n();const { toast } = useToast();const { isDark } = useTheme();+const editorFontFamilyStyle = useEditorFontFamilyStyle();const props = defineProps<{connectionId: string;@@ -603,7 +605,7 @@ onBeforeUnmount(() => {</script><template>- <div class="h-full flex flex-col overflow-hidden">+ <div class="h-full flex flex-col overflow-hidden" :style="editorFontFamilyStyle"><div v-if="loading" class="flex-1 flex items-center justify-center text-muted-foreground">{{ t("common.loading") }}</div>@@ -612,7 +614,9 @@ onBeforeUnmount(() => {<!-- Header --><div class="shrink-0 border-b bg-background"><div class="flex h-9 items-center gap-2 px-4">- <span class="min-w-0 flex-1 truncate font-mono text-sm font-semibold">{{ data.key_display }}</span>+ <span class="dbx-editor-font-family min-w-0 flex-1 truncate text-sm font-semibold">{{+ data.key_display+ }}</span><Button variant="ghost" size="icon" class="h-7 w-7 shrink-0" @click="load"><RefreshCw class="h-3.5 w-3.5"/></Button>@@ -625,7 +629,7 @@ onBeforeUnmount(() => {</div><div class="flex min-h-7 flex-wrap items-center gap-2 px-4 pb-1">- <Badge variant="secondary" class="font-mono text-xs uppercase">{{ data.key_type }}</Badge>+ <Badge variant="secondary" class="dbx-editor-font-family text-xs uppercase">{{ data.key_type }}</Badge><Badge v-if="metadataSizeLabel" variant="outline" class="text-xs text-muted-foreground">{{ t("redis.columnSize") }}: {{ metadataSizeLabel }}</Badge>@@ -697,7 +701,7 @@ onBeforeUnmount(() => {</div><divv-if="stringJsonDetail && stringValueView === 'json'"- class="min-h-0 flex-1 overflow-auto bg-background p-4 font-mono text-sm leading-6"+ class="dbx-editor-font-family min-h-0 flex-1 overflow-auto bg-background p-4 text-sm leading-6"><RedisJsonTree:value="stringJsonDetail.value"@@ -708,7 +712,7 @@ onBeforeUnmount(() => {<textareav-elsev-model="editValue"- class="flex-1 p-4 font-mono text-sm bg-background resize-none outline-none"+ class="dbx-editor-font-family flex-1 p-4 text-sm bg-background resize-none outline-none":class="{ 'whitespace-pre': stringJsonDetail && !redisJsonWordWrap }":readonly="isBinaryStringValue"@input="handleStringInput"@@ -758,7 +762,7 @@ onBeforeUnmount(() => {<template #default="{ item: row }"><divdata-redis-value-row- class="grid grid-cols-[60px_1fr_84px] border-b text-sm font-mono hover:bg-accent/50 group cursor-pointer"+ class="dbx-editor-font-family grid grid-cols-[60px_1fr_84px] border-b text-sm hover:bg-accent/50 group cursor-pointer":class="{ 'bg-accent/60': isSelectedMember(`#${row.index}`, row.value) }":style="{ height: `${REDIS_COLLECTION_ROW_HEIGHT}px` }"@click="viewMember(`#${row.index}`, row.value, { kind: 'list', index: row.index })"@@ -830,7 +834,7 @@ onBeforeUnmount(() => {<template #default="{ item: row }"><divdata-redis-value-row- class="grid grid-cols-[1fr_84px] border-b text-sm font-mono hover:bg-accent/50 group cursor-pointer"+ class="dbx-editor-font-family grid grid-cols-[1fr_84px] border-b text-sm hover:bg-accent/50 group cursor-pointer":class="{ 'bg-accent/60': isSelectedMember(t('redis.member'), row.value) }":style="{ height: `${REDIS_COLLECTION_ROW_HEIGHT}px` }"@click="viewMember(t('redis.member'), row.value, { kind: 'set', member: String(row.value) })"@@ -909,7 +913,7 @@ onBeforeUnmount(() => {<template #default="{ item: row }"><divdata-redis-value-row- class="grid border-b text-sm font-mono hover:bg-accent/50 group cursor-pointer"+ class="dbx-editor-font-family grid border-b text-sm hover:bg-accent/50 group cursor-pointer":style="{ ...hashGridStyle, height: `${REDIS_COLLECTION_ROW_HEIGHT}px` }":class="{ 'bg-accent/60': isSelectedMember(String(row.value.field), row.value.value) }"@click="@@ -990,7 +994,7 @@ onBeforeUnmount(() => {<template #default="{ item: row }"><divdata-redis-value-row- class="grid grid-cols-[100px_1fr_84px] border-b text-sm font-mono hover:bg-accent/50 group cursor-pointer"+ class="dbx-editor-font-family grid grid-cols-[100px_1fr_84px] border-b text-sm hover:bg-accent/50 group cursor-pointer":class="{ 'bg-accent/60': isSelectedMember(String(row.value.score), row.value.member) }":style="{ height: `${REDIS_COLLECTION_ROW_HEIGHT}px` }"@click="@@ -1066,7 +1070,7 @@ onBeforeUnmount(() => {:size-dependencies="[streamFieldCount(row)]":data-index="row.index">- <div data-redis-stream-entry class="px-4 py-2 border-b text-sm font-mono hover:bg-accent/50">+ <div data-redis-stream-entry class="dbx-editor-font-family px-4 py-2 border-b text-sm hover:bg-accent/50"><div class="mb-1 text-xs text-muted-foreground">{{ row.entry.id }}</div><divv-for="[field, val] in streamFields(row.entry)"@@ -1104,7 +1108,7 @@ onBeforeUnmount(() => {<!-- Unknown --><div v-else class="flex-1 overflow-auto p-4">- <pre class="font-mono text-sm whitespace-pre-wrap">{{ formatValue(data.value) }}</pre>+ <pre class="dbx-editor-font-family text-sm whitespace-pre-wrap">{{ formatValue(data.value) }}</pre></div></template>@@ -1121,7 +1125,7 @@ onBeforeUnmount(() => {side="right"class="gap-0 p-0 sm:max-w-[calc(100vw-2rem)]":class="{ 'select-none': isResizingMemberSheet }"- :style="{ width: `${memberDetailSheetWidth}px`, maxWidth: 'calc(100vw - 2rem)' }"+ :style="[editorFontFamilyStyle, { width: `${memberDetailSheetWidth}px`, maxWidth: 'calc(100vw - 2rem)' }]"@close-auto-focus="finishMemberDetailClose"@pointer-down-outside.prevent@interact-outside.prevent@@ -1139,7 +1143,7 @@ onBeforeUnmount(() => {<textareav-if="isEditingMember"v-model="memberEditValue"- class="min-h-0 flex-1 resize-none bg-background p-5 font-mono text-[13px] leading-6 outline-none"+ class="dbx-editor-font-family min-h-0 flex-1 resize-none bg-background p-5 text-[13px] leading-6 outline-none"spellcheck="false"/><template v-else-if="selectedMemberJsonDetail">@@ -1179,7 +1183,7 @@ onBeforeUnmount(() => {</div><divv-if="memberValueView === 'json'"- class="min-h-0 flex-1 overflow-auto bg-background p-5 font-mono text-[13px] leading-6"+ class="dbx-editor-font-family min-h-0 flex-1 overflow-auto bg-background p-5 text-[13px] leading-6"><RedisJsonTree:value="selectedMemberJsonDetail.value"@@ -1189,14 +1193,14 @@ onBeforeUnmount(() => {</div><prev-else- class="min-h-0 flex-1 overflow-auto bg-background p-5 font-mono text-[13px] leading-6"+ class="dbx-editor-font-family min-h-0 flex-1 overflow-auto bg-background p-5 text-[13px] leading-6":class="redisJsonWordWrap ? 'whitespace-pre-wrap break-words' : 'whitespace-pre'"v-html="memberRawJsonHtml"></pre></template><prev-else- class="min-h-0 flex-1 overflow-auto bg-background p-5 font-mono text-[13px] leading-6 whitespace-pre-wrap break-words"+ class="dbx-editor-font-family min-h-0 flex-1 overflow-auto bg-background p-5 text-[13px] leading-6 whitespace-pre-wrap break-words">{{ selectedMemberDetail.text }}</pre><SheetFooter class="shrink-0 border-t px-5 py-3">diff --git a/apps/desktop/src/composables/useEditorFontFamilyStyle.ts b/apps/desktop/src/composables/useEditorFontFamilyStyle.tsnew file mode 100644index 0000000000..d455d4ef4e--- /dev/null+++ b/apps/desktop/src/composables/useEditorFontFamilyStyle.ts@@ -0,0 +1,11 @@+import { computed } from "vue";+import { EDITOR_FONT_FAMILY_CSS_VAR } from "@/lib/editorThemes";+import { useSettingsStore } from "@/stores/settingsStore";++export function useEditorFontFamilyStyle() {+ const settingsStore = useSettingsStore();++ return computed<Record<string, string>>(() => ({+ [EDITOR_FONT_FAMILY_CSS_VAR]: settingsStore.editorSettings.fontFamily,+ }));+}diff --git a/apps/desktop/src/styles/globals.css b/apps/desktop/src/styles/globals.cssindex f2ba0aebb2..c8e797fe88 100644--- a/apps/desktop/src/styles/globals.css+++ b/apps/desktop/src/styles/globals.css@@ -151,6 +151,10 @@ html.disable-transitions *::after {}}+.dbx-editor-font-family {+ font-family: var(--dbx-editor-font-family, var(--font-mono, monospace));+}+/* Splitpanes */.splitpanes--horizontal .splitpanes__pane {transition: none !important;diff --git a/packages/app-tests/editorCompletionTheme.test.ts b/packages/app-tests/editorCompletionTheme.test.tsindex 6fb78008e6..a62cbf7e2c 100644--- a/packages/app-tests/editorCompletionTheme.test.ts+++ b/packages/app-tests/editorCompletionTheme.test.ts@@ -39,11 +39,26 @@ test("sql completion theme styles the autocomplete popup", () => {assert.equal(rules[".cm-completionIcon:before"]?.content, "''");assert.equal(rules[".cm-completionIcon:before"]?.WebkitMaskSize, "14px 14px");assert.equal(rules[".cm-completionIcon:after"]?.display, "none");- assert.equal(rules[".cm-completionIcon-table"]?.color, "color-mix(in oklch, var(--primary) 92%, var(--popover-foreground))");- assert.equal(rules[".cm-completionIcon-column"]?.color, "color-mix(in oklch, var(--blue-500, #3b82f6) 92%, var(--popover-foreground))");- assert.equal(rules[".cm-completionIcon-keyword"]?.color, "color-mix(in oklch, var(--orange-500, #f97316) 92%, var(--popover-foreground))");- assert.equal(rules[".cm-completionIcon-keyword"]?.["--dbx-completion-icon-mask"]?.includes("m16%2018%206-6-6-6"), true);- assert.equal(rules[".cm-completionIcon-snippet"]?.color, "color-mix(in oklch, var(--emerald-500, #10b981) 92%, var(--popover-foreground))");+ assert.equal(+ rules[".cm-completionIcon-table"]?.color,+ "color-mix(in oklch, var(--primary) 92%, var(--popover-foreground))",+ );+ assert.equal(+ rules[".cm-completionIcon-column"]?.color,+ "color-mix(in oklch, var(--blue-500, #3b82f6) 92%, var(--popover-foreground))",+ );+ assert.equal(+ rules[".cm-completionIcon-keyword"]?.color,+ "color-mix(in oklch, var(--orange-500, #f97316) 92%, var(--popover-foreground))",+ );+ assert.equal(+ rules[".cm-completionIcon-keyword"]?.["--dbx-completion-icon-mask"]?.includes("m16%2018%206-6-6-6"),+ true,+ );+ assert.equal(+ rules[".cm-completionIcon-snippet"]?.color,+ "color-mix(in oklch, var(--emerald-500, #10b981) 92%, var(--popover-foreground))",+ );assert.deepEqual(rules[".cm-completionLabel"], {color: "inherit",fontFamily: `var(${EDITOR_FONT_FAMILY_CSS_VAR}, var(--font-mono, monospace))`,@@ -72,6 +87,8 @@ test("editor font theme reads size and family from CSS variables", () => {assert.equal(rules["&"]?.fontSize, `var(${EDITOR_FONT_SIZE_CSS_VAR}, 13px)`);assert.deepEqual(rules[".cm-content"], {fontFamily: `var(${EDITOR_FONT_FAMILY_CSS_VAR}, monospace)`,+ lineHeight: "1.6",+ padding: "0",});assert.equal(rules[".cm-gutters"]?.fontSize, `var(${EDITOR_FONT_SIZE_CSS_VAR}, 13px)`);assert.deepEqual(rules[".cm-scroller"], { overflow: "auto" });diff --git a/packages/app-tests/redisKeyBrowserCreateKey.test.ts b/packages/app-tests/redisKeyBrowserCreateKey.test.tsindex 556dab7057..738528ec86 100644--- a/packages/app-tests/redisKeyBrowserCreateKey.test.ts+++ b/packages/app-tests/redisKeyBrowserCreateKey.test.ts@@ -92,11 +92,54 @@ test("Redis command workspace uses a terminal-like surface", () => {assert.match(source, /{{ commandPrompt }}/);assert.match(source, /{{ entry\.prompt }}/);assert.match(source, /{{ entry\.command }}/);- assert.match(source, /class="relative flex min-h-0 flex-1 flex-col bg-\[#090c10\] font-mono text-\[13px\] leading-5 text-slate-100"/);+ assert.match(+ source,+ /class="dbx-editor-font-family relative flex min-h-0 flex-1 flex-col bg-\[#090c10\] text-\[13px\] leading-5 text-slate-100"/,+ );assert.match(source, /class="flex shrink-0 items-center gap-2 border-t border-white\/10 bg-\[#090c10\] px-4 py-2"/);- assert.match(source, /class="min-w-0 flex-1 border-0 bg-transparent p-0 font-mono text-\[13px\] text-slate-100 caret-\[#d7ba7d\] outline-none/);+ assert.match(+ source,+ /class="dbx-editor-font-family min-w-0 flex-1 border-0 bg-transparent p-0 text-\[13px\] text-slate-100 caret-\[#d7ba7d\] outline-none/,+ );assert.doesNotMatch(source, /class="border-b border-slate-800 bg-slate-950 px-4 py-3 text-slate-100"/);- assert.doesNotMatch(source, /class="min-h-full whitespace-pre-wrap break-words rounded-md border border-slate-800 bg-slate-950/);+ assert.doesNotMatch(+ source,+ /class="min-h-full whitespace-pre-wrap break-words rounded-md border border-slate-800 bg-slate-950/,+ );+});++test("Redis text surfaces inherit the configured editor font family without changing sizing classes", () => {+ const keyBrowserSource = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8");+ const valueViewerSource = readFileSync("apps/desktop/src/components/redis/RedisValueViewer.vue", "utf8");+ const fontComposableSource = readFileSync("apps/desktop/src/composables/useEditorFontFamilyStyle.ts", "utf8");+ const globalStylesSource = readFileSync("apps/desktop/src/styles/globals.css", "utf8");++ assert.match(fontComposableSource, /EDITOR_FONT_FAMILY_CSS_VAR/);+ assert.match(fontComposableSource, /\[EDITOR_FONT_FAMILY_CSS_VAR\]: settingsStore\.editorSettings\.fontFamily/);+ assert.match(globalStylesSource, /\.dbx-editor-font-family/);+ assert.match(globalStylesSource, /font-family: var\(--dbx-editor-font-family, var\(--font-mono, monospace\)\)/);++ assert.match(keyBrowserSource, /const editorFontFamilyStyle = useEditorFontFamilyStyle\(\)/);+ assert.match(keyBrowserSource, /<div ref="rootRef" class="h-full" :style="editorFontFamilyStyle">/);+ assert.match(keyBrowserSource, /<DialogContent class="sm:max-w-md" :style="editorFontFamilyStyle">/);+ assert.match(keyBrowserSource, /class="dbx-editor-font-family truncate"/);+ assert.match(keyBrowserSource, /class="dbx-editor-font-family h-8 text-xs"/);+ assert.match(keyBrowserSource, /class="dbx-editor-font-family .* text-\[13px\] leading-5/);++ assert.match(valueViewerSource, /const editorFontFamilyStyle = useEditorFontFamilyStyle\(\)/);+ assert.match(valueViewerSource, /<div class="h-full flex flex-col overflow-hidden" :style="editorFontFamilyStyle">/);+ assert.match(+ valueViewerSource,+ /:style="\[editorFontFamilyStyle, \{ width: `\$\{memberDetailSheetWidth\}px`, maxWidth: 'calc\(100vw - 2rem\)' \}\]"/,+ );+ assert.match(+ valueViewerSource,+ /class="dbx-editor-font-family min-h-0 flex-1 overflow-auto bg-background p-4 text-sm leading-6"/,+ );+ assert.match(+ valueViewerSource,+ /class="dbx-editor-font-family min-h-0 flex-1 resize-none bg-background p-5 text-\[13px\] leading-6 outline-none"/,+ );});test("Redis browser uses a single thin shared splitter between panes", () => {