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(settings): keep footer buttons clickable at high ui scale
GGbond3015313d238c
diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vueindex a27799aebd..b53f112343 100644--- a/apps/desktop/src/App.vue+++ b/apps/desktop/src/App.vue@@ -76,7 +76,7 @@ import { useWebDavAutoUpload } from "@/composables/useWebDavAutoUpload";import { useSnippetAutoUpload } from "@/composables/useSnippetAutoUpload";import { readSyncMethod, readWebDavAutoUploadConfig, readWebDavBackupSelection, recordWebDavSyncSuccess } from "@/lib/webdav/webdavAutoUploadConfig";import { useScheduledDatabaseBackups } from "@/composables/useScheduledDatabaseBackups";-import { shouldDrawDesktopWindowFrame, shouldDrawLinuxFloatingFrame, useWindowControls } from "@/composables/useWindowControls";+import { appShellMinSizeStyleForScale, shouldDrawDesktopWindowFrame, shouldDrawLinuxFloatingFrame, useWindowControls } from "@/composables/useWindowControls";import { createOpenTabsRestorationBarrier, initializeDesktopOpenTabs, initializeOpenTabs, type OpenTabsRestorationBarrier } from "@/lib/app/openTabsStartup";import { finishAppCloseWithRequiredPersist } from "@/lib/app/appClosePersistence";import { useSaveSqlFolderSelection } from "@/composables/useSaveSqlFolderSelection";@@ -1693,12 +1693,18 @@ const saveSqlFolders = computed(() => {}));});+/** 最近一次实际应用到 webview 的界面缩放(setZoom IPC 成功后才更新)。 */+const appliedUiScale = ref(1);+const uiScaleApplyQueue = createUiScaleApplyQueue(async (scale) => {const { getCurrentWebview } = await import("@tauri-apps/api/webview");await getCurrentWebview().setZoom(scale);},(scale) => {+ // webview 缩放是重排式的(pageZoom / ZoomFactor):倍率越大,CSS 视口越小。+ // 记录实际倍率供应用外壳的最小尺寸换算,保证下限永远不超出视口。+ appliedUiScale.value = scale;window.dispatchEvent(new CustomEvent("dbx:ui-scale-applied", { detail: { scale } }));},(scale, error) => {@@ -1776,6 +1782,8 @@ const appUiFontFamilyStyle = computed<Record<string, string>>(() => {};});+const appShellMinSizeStyle = computed(() => appShellMinSizeStyleForScale(appliedUiScale.value));+function isGlobalUiZoomTarget(target: EventTarget | null): target is Element {if (!(target instanceof Element)) return false;if (target.closest("[data-query-editor-root], [data-cell-detail-editor-root], [data-object-source-editor]")) {@@ -5172,7 +5180,11 @@ onUnmounted(() => {<TooltipProvider :delay-duration="300"><SidebarDangerDialogHost /><LinuxResizeHandles v-if="drawLinuxFloatingFrame" />- <div data-app-shell class="h-screen w-screen max-w-full min-w-[760px] min-h-[600px] flex flex-col bg-background text-foreground overflow-hidden" :class="{ 'dbx-desktop-window-frame': drawDesktopWindowFrame }" :style="appUiFontFamilyStyle">+ <!-- 外壳维持 760x600 的 *视觉* 像素最小可用尺寸(参见 fix(desktop): prevent scaled window clipping)。+ webview 缩放是重排式的,最小尺寸必须除以实际倍率换算成 CSS 像素+ (见 appShellMinSizeStyleForScale)——固定 CSS 下限在约 165% 以上缩放+ 时会超出视口,把应用底部(如设置页脚按钮)挤出窗口导致无法点击。 -->+ <div data-app-shell class="h-screen w-screen max-w-full flex flex-col bg-background text-foreground overflow-hidden" :class="{ 'dbx-desktop-window-frame': drawDesktopWindowFrame }" :style="[appUiFontFamilyStyle, appShellMinSizeStyle]"><AppToolbarv-if="!isDetachedWindowContext":is-dark="isDark"diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vueindex 045497ade9..6fd125f6f1 100644--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue@@ -614,7 +614,7 @@ const settingsRootProps = computed(() => (isSettingsPage.value ? {} : { open: prconst settingsRootClass = computed(() => (isSettingsPage.value ? "h-full min-h-0 overflow-hidden bg-background" : ""));const settingsContentComponent = computed(() => (isSettingsPage.value ? "div" : DialogContent));const settingsContentClass = computed(() =>- isSettingsPage.value ? "flex h-full min-h-0 flex-col gap-4 overflow-hidden bg-background p-4" : "h-[min(660px,calc(var(--dbx-viewport-height)-80px))] !max-w-[min(920px,calc(100vw-32px))] grid-rows-[auto_minmax(0,1fr)] gap-3 p-4 sm:!max-w-[min(920px,calc(100vw-48px))]",+ isSettingsPage.value ? "flex h-full min-h-0 flex-col gap-4 overflow-hidden bg-background p-4" : "h-[min(660px,calc(var(--dbx-viewport-height)-80px))] !max-w-[min(920px,calc(100vw-32px))] grid-rows-[auto_minmax(0,1fr)_auto] gap-3 p-4 sm:!max-w-[min(920px,calc(100vw-48px))]",);const settingsTitleComponent = computed(() => (isSettingsPage.value ? "h2" : DialogTitle));@@ -7393,7 +7393,7 @@ onUnmounted(() => {</button></div></div>- <div v-if="activeSettingsTab === 'editor' && !settingsSearchVisible" class="settings-editor-live-preview shrink-0 px-1 pr-2" data-editor-live-preview>+ <div v-if="activeSettingsTab === 'editor' && !settingsSearchVisible" class="settings-editor-live-preview min-h-0 shrink overflow-hidden px-1 pr-2" data-editor-live-preview><div class="space-y-2 py-2"><Label>{{ t("settings.preview") }}</Label><div class="settings-editor-live-preview-surface rounded-md border max-w-full" :class="editTheme === 'vscode-light' || editTheme === 'duotone-light' || editTheme === 'xcode' ? 'border-border' : 'border-border/50'">@@ -12906,127 +12906,136 @@ LIMIT 100;</pre></div></section></div>-- <DialogFooter v-if="hasSettingsApplyFooter(activeSettingsTab as SettingsCategory)" class="mx-0 mb-0 flex-row flex-wrap items-center justify-end gap-2 rounded-none border-t border-border/60 bg-transparent px-0 pb-0 pt-3 sm:flex-row sm:gap-2 [&>button]:w-auto [&>button]:shrink-0">- <Button variant="outline" @click="resetDefaultsForTab(activeSettingsTab as SettingsCategory)">- {{ t("settings.resetDefaults") }}- </Button>- <!-- 行内冲突说明收进浮层后,“应用为何被禁用”需要一处常驻解释。 -->- <span v-if="hasBlockingShortcutConflicts" class="inline-flex items-center gap-1.5 text-xs text-destructive">- <AlertTriangle class="h-3.5 w-3.5 shrink-0" aria-hidden="true" />- {{ t("settings.shortcutConflictBlocksApply", { count: shortcutConflicts.length, pairs: shortcutConflictPairCount }) }}- </span>- <div class="flex-1" />- <Button variant="outline" @click="closeSettings">- {{ t("common.close") }}- </Button>- <Button :disabled="!hasChanges() || hasApplyBlocker" @click="applySettings">- {{ t("settings.apply") }}- </Button>- <Button :disabled="!hasChanges() || hasApplyBlocker" @click="applySettingsAndClose">- {{ t("settings.applyAndClose") }}- </Button>- </DialogFooter>-- <DialogFooter v-else-if="activeSettingsTab === 'ai'" class="mx-0 mb-0 flex-row flex-wrap items-center justify-end gap-2 rounded-none border-t border-border/60 bg-transparent px-0 pb-0 pt-3 sm:flex-row sm:gap-2 [&>button]:w-auto [&>button]:shrink-0">- <template v-if="aiConfigListMode === 'list'">- <div class="flex-1" />- <Button variant="outline" @click="closeSettings">{{ t("common.close") }}</Button>- </template>- <template v-else>- <template v-if="aiIsCcSwitchProvider">- <div class="flex-1" />- <Button variant="outline" @click="aiEnterListMode()">{{ t("common.cancel") }}</Button>- </template>- <template v-else>- <div class="flex min-w-0 flex-1 items-center gap-2">- <Button size="sm" variant="outline" :disabled="aiTesting || !!aiCliValidationError || !!aiHeadersValidationError || (aiRequiresApiKey && !aiEditApiKey?.trim()) || (!aiIsCliProvider && !aiEditEndpoint?.trim())" @click="aiTestConn">- <Loader2 v-if="aiTesting" class="h-3 w-3 animate-spin mr-1" />- {{ t("connection.test") }}- </Button>- <span v-if="aiTestResult === 'success'" class="text-xs text-green-500 flex items-center gap-1.5">- <span>{{ t("connection.testSuccess") }}</span>- <span v-if="aiTestLatency != null" class="text-green-500/70">{{ aiTestLatency }}ms</span>- </span>- <span v-else-if="aiTestResult === 'error'" class="flex min-w-0 max-w-lg items-center gap-1.5 text-xs text-destructive">- <span class="min-w-0 select-text leading-4" :title="aiTestErrorDisplay">- <span v-if="aiTestErrorPresentation.summary" class="block font-medium">{{ aiTestErrorPresentation.summary }}</span>- <span class="block truncate text-destructive/80">{{ aiTestErrorPresentation.detail }}</span>- </span>- <Button- type="button"- variant="ghost"- size="icon"- class="h-6 w-6 shrink-0 text-destructive/80 hover:text-destructive"- :title="aiTestErrorCopied ? t('ai.copied') : t('ai.copyTestResult')"- :aria-label="aiTestErrorCopied ? t('ai.copied') : t('ai.copyTestResult')"- @click="copyAiTestError"- >- <CheckCircle2 v-if="aiTestErrorCopied" class="h-3.5 w-3.5" />- <Copy v-else class="h-3.5 w-3.5" />- </Button>- </span>- </div>- <Button variant="outline" @click="aiEnterListMode()">{{ t("common.cancel") }}</Button>- <Button :disabled="!aiEditConfigName.trim() || !!aiCliValidationError" @click="aiSaveConfig">{{ t("settings.apply") }}</Button>- </template>- </template>- </DialogFooter>-- <DialogFooter v-else-if="activeSettingsTab === 'sync' || activeSettingsTab === 'backups'" class="mx-0 mb-0 flex-row flex-wrap items-center justify-end gap-2 rounded-none border-t border-border/60 bg-transparent px-0 pb-0 pt-3 sm:flex-row sm:gap-2 [&>button]:w-auto [&>button]:shrink-0">- <Button variant="outline" @click="closeSettings">- {{ t("common.close") }}- </Button>- </DialogFooter>-- <DialogFooter v-else-if="activeSettingsTab === 'mcp'" class="mx-0 mb-0 flex-row flex-wrap items-center justify-end gap-2 rounded-none border-t border-border/60 bg-transparent px-0 pb-0 pt-3 sm:flex-row sm:gap-2 [&>button]:w-auto [&>button]:shrink-0">- <Button variant="outline" @click="closeSettings">- {{ t("common.close") }}- </Button>- <div class="flex-1" />- <Button v-if="!isWeb" variant="outline" :disabled="mcpStatusLoading" @click="refreshMcpStatus">- <Loader2 v-if="mcpStatusLoading" class="mr-1 h-3 w-3 animate-spin" />- <RefreshCw v-else class="mr-1 h-3 w-3" />- {{ t("settings.mcpRefresh") }}- </Button>- <Button variant="outline" @click="openExternalUrl('https://dbxio.com/cn/docs/mcp')">- <ExternalLink class="mr-1 h-3 w-3" />- {{ t("settings.mcpGuide") }}- </Button>- <Button :disabled="!hasChanges() || hasApplyBlocker" @click="applySettings">- {{ t("settings.apply") }}- </Button>- <Button :disabled="!hasChanges() || hasApplyBlocker" @click="applySettingsAndClose">- {{ t("settings.applyAndClose") }}- </Button>- </DialogFooter>-- <DialogFooter v-else-if="activeSettingsTab === 'security' && isWeb" class="mx-0 mb-0 flex-row flex-wrap items-center justify-end gap-2 rounded-none border-t border-border/60 bg-transparent px-0 pb-0 pt-3 sm:flex-row sm:gap-2 [&>button]:w-auto [&>button]:shrink-0">- <Button variant="outline" @click="closeSettings">- {{ t("common.close") }}- </Button>- <Button :disabled="changingPassword || !oldPassword || !newPassword || !confirmNewPassword" @click="changePassword">- {{ t("auth.changePassword") }}- </Button>- </DialogFooter>-- <DialogFooter v-else-if="activeSettingsTab === 'about'" class="mx-0 mb-0 flex-row flex-wrap items-center justify-end gap-2 rounded-none border-t border-border/60 bg-transparent px-0 pb-0 pt-3 sm:flex-row sm:gap-2 [&>button]:w-auto [&>button]:shrink-0">- <Button variant="outline" @click="resetAllDefaults">- {{ t("settings.resetAllDefaults") }}- </Button>- <div class="flex-1" />- <Button variant="outline" @click="closeSettings">- {{ t("common.close") }}- </Button>- <Button :disabled="!hasChanges() || hasApplyBlocker" @click="applySettings">- {{ t("settings.apply") }}- </Button>- <Button :disabled="!hasChanges() || hasApplyBlocker" @click="applySettingsAndClose">- {{ t("settings.applyAndClose") }}- </Button>- </DialogFooter></div></div>++ <!--+ * 页脚按钮放在 settings-layout 之外——dialog 变体是第三行网格+ * (grid-rows-[auto_minmax(0,1fr)_auto]),page 变体是 shrink-0 的同级元素——+ * 这样滚动的主体内容永远不会把按钮挤出可视区(issue:界面缩放 ≥165% 时+ * 恢复默认/关闭/应用/应用并关闭 无法点击)。+ -->+ <DialogFooter v-if="hasSettingsApplyFooter(activeSettingsTab as SettingsCategory)" class="shrink-0 mx-0 mb-0 flex-row flex-wrap items-center justify-end gap-2 rounded-none border-t border-border/60 bg-transparent px-0 pb-0 pt-3 sm:flex-row sm:gap-2 [&>button]:w-auto [&>button]:shrink-0">+ <Button variant="outline" @click="resetDefaultsForTab(activeSettingsTab as SettingsCategory)">+ {{ t("settings.resetDefaults") }}+ </Button>+ <!-- 行内冲突说明收进浮层后,“应用为何被禁用”需要一处常驻解释。 -->+ <span v-if="hasBlockingShortcutConflicts" class="inline-flex items-center gap-1.5 text-xs text-destructive">+ <AlertTriangle class="h-3.5 w-3.5 shrink-0" aria-hidden="true" />+ {{ t("settings.shortcutConflictBlocksApply", { count: shortcutConflicts.length, pairs: shortcutConflictPairCount }) }}+ </span>+ <div class="flex-1" />+ <Button variant="outline" @click="closeSettings">+ {{ t("common.close") }}+ </Button>+ <Button :disabled="!hasChanges() || hasApplyBlocker" @click="applySettings">+ {{ t("settings.apply") }}+ </Button>+ <Button :disabled="!hasChanges() || hasApplyBlocker" @click="applySettingsAndClose">+ {{ t("settings.applyAndClose") }}+ </Button>+ </DialogFooter>++ <DialogFooter v-else-if="activeSettingsTab === 'ai'" class="shrink-0 mx-0 mb-0 flex-row flex-wrap items-center justify-end gap-2 rounded-none border-t border-border/60 bg-transparent px-0 pb-0 pt-3 sm:flex-row sm:gap-2 [&>button]:w-auto [&>button]:shrink-0">+ <template v-if="aiConfigListMode === 'list'">+ <div class="flex-1" />+ <Button variant="outline" @click="closeSettings">{{ t("common.close") }}</Button>+ </template>+ <template v-else>+ <template v-if="aiIsCcSwitchProvider">+ <div class="flex-1" />+ <Button variant="outline" @click="aiEnterListMode()">{{ t("common.cancel") }}</Button>+ </template>+ <template v-else>+ <div class="flex min-w-0 flex-1 items-center gap-2">+ <Button size="sm" variant="outline" :disabled="aiTesting || !!aiCliValidationError || !!aiHeadersValidationError || (aiRequiresApiKey && !aiEditApiKey?.trim()) || (!aiIsCliProvider && !aiEditEndpoint?.trim())" @click="aiTestConn">+ <Loader2 v-if="aiTesting" class="h-3 w-3 animate-spin mr-1" />+ {{ t("connection.test") }}+ </Button>+ <span v-if="aiTestResult === 'success'" class="text-xs text-green-500 flex items-center gap-1.5">+ <span>{{ t("connection.testSuccess") }}</span>+ <span v-if="aiTestLatency != null" class="text-green-500/70">{{ aiTestLatency }}ms</span>+ </span>+ <span v-else-if="aiTestResult === 'error'" class="flex min-w-0 max-w-lg items-center gap-1.5 text-xs text-destructive">+ <span class="min-w-0 select-text leading-4" :title="aiTestErrorDisplay">+ <span v-if="aiTestErrorPresentation.summary" class="block font-medium">{{ aiTestErrorPresentation.summary }}</span>+ <span class="block truncate text-destructive/80">{{ aiTestErrorPresentation.detail }}</span>+ </span>+ <Button+ type="button"+ variant="ghost"+ size="icon"+ class="h-6 w-6 shrink-0 text-destructive/80 hover:text-destructive"+ :title="aiTestErrorCopied ? t('ai.copied') : t('ai.copyTestResult')"+ :aria-label="aiTestErrorCopied ? t('ai.copied') : t('ai.copyTestResult')"+ @click="copyAiTestError"+ >+ <CheckCircle2 v-if="aiTestErrorCopied" class="h-3.5 w-3.5" />+ <Copy v-else class="h-3.5 w-3.5" />+ </Button>+ </span>+ </div>+ <Button variant="outline" @click="aiEnterListMode()">{{ t("common.cancel") }}</Button>+ <Button :disabled="!aiEditConfigName.trim() || !!aiCliValidationError" @click="aiSaveConfig">{{ t("settings.apply") }}</Button>+ </template>+ </template>+ </DialogFooter>++ <DialogFooter+ v-else-if="activeSettingsTab === 'sync' || activeSettingsTab === 'backups'"+ class="shrink-0 mx-0 mb-0 flex-row flex-wrap items-center justify-end gap-2 rounded-none border-t border-border/60 bg-transparent px-0 pb-0 pt-3 sm:flex-row sm:gap-2 [&>button]:w-auto [&>button]:shrink-0"+ >+ <Button variant="outline" @click="closeSettings">+ {{ t("common.close") }}+ </Button>+ </DialogFooter>++ <DialogFooter v-else-if="activeSettingsTab === 'mcp'" class="shrink-0 mx-0 mb-0 flex-row flex-wrap items-center justify-end gap-2 rounded-none border-t border-border/60 bg-transparent px-0 pb-0 pt-3 sm:flex-row sm:gap-2 [&>button]:w-auto [&>button]:shrink-0">+ <Button variant="outline" @click="closeSettings">+ {{ t("common.close") }}+ </Button>+ <div class="flex-1" />+ <Button v-if="!isWeb" variant="outline" :disabled="mcpStatusLoading" @click="refreshMcpStatus">+ <Loader2 v-if="mcpStatusLoading" class="mr-1 h-3 w-3 animate-spin" />+ <RefreshCw v-else class="mr-1 h-3 w-3" />+ {{ t("settings.mcpRefresh") }}+ </Button>+ <Button variant="outline" @click="openExternalUrl('https://dbxio.com/cn/docs/mcp')">+ <ExternalLink class="mr-1 h-3 w-3" />+ {{ t("settings.mcpGuide") }}+ </Button>+ <Button :disabled="!hasChanges() || hasApplyBlocker" @click="applySettings">+ {{ t("settings.apply") }}+ </Button>+ <Button :disabled="!hasChanges() || hasApplyBlocker" @click="applySettingsAndClose">+ {{ t("settings.applyAndClose") }}+ </Button>+ </DialogFooter>++ <DialogFooter v-else-if="activeSettingsTab === 'security' && isWeb" class="shrink-0 mx-0 mb-0 flex-row flex-wrap items-center justify-end gap-2 rounded-none border-t border-border/60 bg-transparent px-0 pb-0 pt-3 sm:flex-row sm:gap-2 [&>button]:w-auto [&>button]:shrink-0">+ <Button variant="outline" @click="closeSettings">+ {{ t("common.close") }}+ </Button>+ <Button :disabled="changingPassword || !oldPassword || !newPassword || !confirmNewPassword" @click="changePassword">+ {{ t("auth.changePassword") }}+ </Button>+ </DialogFooter>++ <DialogFooter v-else-if="activeSettingsTab === 'about'" class="shrink-0 mx-0 mb-0 flex-row flex-wrap items-center justify-end gap-2 rounded-none border-t border-border/60 bg-transparent px-0 pb-0 pt-3 sm:flex-row sm:gap-2 [&>button]:w-auto [&>button]:shrink-0">+ <Button variant="outline" @click="resetAllDefaults">+ {{ t("settings.resetAllDefaults") }}+ </Button>+ <div class="flex-1" />+ <Button variant="outline" @click="closeSettings">+ {{ t("common.close") }}+ </Button>+ <Button :disabled="!hasChanges() || hasApplyBlocker" @click="applySettings">+ {{ t("settings.apply") }}+ </Button>+ <Button :disabled="!hasChanges() || hasApplyBlocker" @click="applySettingsAndClose">+ {{ t("settings.applyAndClose") }}+ </Button>+ </DialogFooter></component><!-- Unsaved settings confirmation: guards every close path (Escape, outside click, the X button, and the footer "Close" button) so an unapplied draft is never silently discarded. -->diff --git a/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.footerLayout.integration.spec.ts b/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.footerLayout.integration.spec.tsnew file mode 100644index 0000000000..1798c5ebb0--- /dev/null+++ b/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.footerLayout.integration.spec.ts@@ -0,0 +1,139 @@+// @vitest-environment happy-dom++import { createApp, defineComponent, h, nextTick, type App } from "vue";+import { createPinia, setActivePinia } from "pinia";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import i18n from "@/i18n";+import { useSettingsStore } from "@/stores/settingsStore";+import EditorSettingsDialog from "../EditorSettingsDialog.vue";++const backend = vi.hoisted(() => ({ saved: null as unknown }));++vi.mock("@/lib/backend/api", async (importOriginal) => {+ const actual = await importOriginal<typeof import("@/lib/backend/api")>();+ return {+ ...actual,+ loadEditorSettings: async () => backend.saved,+ saveEditorSettings: async () => undefined,+ loadHistoryRetentionLimit: async () => 5000,+ loadMcpHistoryRetentionLimit: async () => 5000,+ loadMcpGlobalPolicy: async () => null,+ loadDesktopSettings: async () => null,+ loadAiConfigs: async () => [],+ loadAiConfig: async () => null,+ loadAiProviderConfigs: async () => ({}),+ loadAiChatSelection: async () => null,+ webdavSyncSecretsStatus: async () => ({}),+ snippetSavedTokenStatus: async () => ({}),+ snippetSyncSettings: async () => ({}),+ getAppSupportInfo: async () => {+ throw new Error("unavailable in tests");+ },+ listInstalledAgentsLocal: async () => [],+ checkMcpServerStatus: async () => {+ throw new Error("unavailable in tests");+ },+ };+});++let app: App | undefined;+let host: HTMLElement;++async function settle() {+ for (let i = 0; i < 10; i++) {+ await Promise.resolve();+ await nextTick();+ }+}++beforeEach(() => {+ backend.saved = null;+ localStorage.clear();+});++afterEach(() => {+ app?.unmount();+ host?.remove();+ document.body.innerHTML = "";+ app = undefined;+});++async function mountSettings(variant: "page" | "dialog") {+ const pinia = createPinia();+ setActivePinia(pinia);+ const store = useSettingsStore();+ await store.initEditorSettings();+ await store.initDesktopSettings();+ host = document.createElement("div");+ document.body.append(host);+ app = createApp(+ defineComponent({+ setup: () => () =>+ h(EditorSettingsDialog, {+ variant,+ open: true,+ initialTab: "editor",+ "onUpdate:open": () => undefined,+ }),+ }),+ );+ app.use(pinia);+ app.use(i18n);+ app.mount(host);+ await settle();+ return { store };+}++async function switchTab(labelKey: string) {+ const label = i18n.global.t(labelKey);+ const button = Array.from(host.querySelectorAll(".settings-category-nav button")).find((item) => item.textContent?.trim() === label);+ expect(button, labelKey).toBeTruthy();+ button!.click();+ await settle();+}++function expectFooterOutsideScrollingBody(root: ParentNode) {+ const footers = root.querySelectorAll('[data-slot="dialog-footer"]');+ expect(footers.length).toBe(1);+ const footer = footers[0];+ const layout = root.querySelector(".settings-layout")!;+ expect(layout).toBeTruthy();+ // 核心回归契约:页脚必须在滚动主体(settings-layout)之外——原来它在内容列的+ // flex 堆叠内,搜索框+实时预览+页脚一旦超过视口换算高度就把它挤出窗口。+ expect(footer.closest(".settings-layout")).toBeNull();+ expect(footer.parentElement).toBe(layout.parentElement);+ expect(footer.previousElementSibling).toBe(layout);+}++// 回归(界面缩放 ≥165% 时 恢复默认/关闭/应用/应用并关闭 被挤出窗口外无法点击):+// 每个分类的页脚都必须固定在滚动主体之外,且同一时刻只渲染一个。+describe("EditorSettingsDialog footer layout", () => {+ it.each([+ ["appearance", "settings.appearanceTab"],+ ["editor", "settings.editorTab"],+ ["ai", "settings.aiTab"],+ ["sync", "settings.syncTab"],+ ["mcp", "settings.mcpTab"],+ ["about", "settings.aboutTab"],+ ])("keeps the %s tab footer outside the scrolling body (page variant)", async (tab, labelKey) => {+ await mountSettings("page");+ if (tab !== "editor") await switchTab(labelKey);+ expectFooterOutsideScrollingBody(host);+ });++ it("keeps the footer outside the scrolling body (dialog variant)", async () => {+ await mountSettings("dialog");+ const dialog = document.querySelector('[data-slot="dialog-content"]');+ expect(dialog).toBeTruthy();+ expectFooterOutsideScrollingBody(dialog!);+ expect(dialog!.classList.contains("grid-rows-[auto_minmax(0,1fr)_auto]")).toBe(true);+ });++ it("lets the editor live preview yield space instead of forcing the footer out", async () => {+ await mountSettings("page");+ const preview = host.querySelector<HTMLElement>("[data-editor-live-preview]")!;+ expect(preview).toBeTruthy();+ expect(preview.classList.contains("shrink-0")).toBe(false);+ expect(preview.classList.contains("min-h-0")).toBe(true);+ });+});diff --git a/apps/desktop/src/composables/__tests__/useWindowControls.spec.ts b/apps/desktop/src/composables/__tests__/useWindowControls.spec.tsindex 09e843701e..86ea9da0a3 100644--- a/apps/desktop/src/composables/__tests__/useWindowControls.spec.ts+++ b/apps/desktop/src/composables/__tests__/useWindowControls.spec.ts@@ -1,5 +1,5 @@import { describe, expect, it } from "vitest";-import { macTrafficLightInsetPaddingForScale, macTrafficLightPositionForScale, shouldDrawDesktopWindowFrame, shouldDrawLinuxFloatingFrame, shouldReserveMacTrafficLightInset, shouldShowWindowControls } from "@/composables/useWindowControls";+import { appShellMinSizeStyleForScale, macTrafficLightInsetPaddingForScale, macTrafficLightPositionForScale, shouldDrawDesktopWindowFrame, shouldDrawLinuxFloatingFrame, shouldReserveMacTrafficLightInset, shouldShowWindowControls } from "@/composables/useWindowControls";describe("window controls", () => {it("shows custom controls for non-macOS desktop windows", () => {@@ -54,4 +54,22 @@ describe("window controls", () => {expect(macTrafficLightPositionForScale(1.1)).toEqual({ x: 16, y: 20 });expect(macTrafficLightPositionForScale(1.25)).toEqual({ x: 16, y: 23 });});++ // 回归(界面缩放 ≥165% 时设置页脚按钮被挤出窗口):webview 缩放重排后 CSS+ // 视口随倍率缩小,760x600 的下限必须以视觉像素为基准除以倍率换算;100%+ // 缩放时必须与原固定下限完全一致,才能保住 prevent scaled window clipping+ // 的保护。非法倍率回退按 100% 处理。+ it.each([+ [1, { minWidth: "760px", minHeight: "600px" }],+ [0.75, { minWidth: "1014px", minHeight: "800px" }],+ [1.5, { minWidth: "507px", minHeight: "400px" }],+ [1.75, { minWidth: "435px", minHeight: "343px" }],+ [2, { minWidth: "380px", minHeight: "300px" }],+ ])("keeps the app shell floor in visual pixels at UI scale %s", (scale, expected) => {+ expect(appShellMinSizeStyleForScale(scale)).toEqual(expected);+ });++ it.each([0, -1, Number.NaN, Number.POSITIVE_INFINITY])("falls back to the 100%% floor for invalid UI scale %s", (scale) => {+ expect(appShellMinSizeStyleForScale(scale)).toEqual({ minWidth: "760px", minHeight: "600px" });+ });});diff --git a/apps/desktop/src/composables/useWindowControls.ts b/apps/desktop/src/composables/useWindowControls.tsindex 5e05c085e0..6452a34eaf 100644--- a/apps/desktop/src/composables/useWindowControls.ts+++ b/apps/desktop/src/composables/useWindowControls.ts@@ -10,6 +10,8 @@ export const MAC_TRAFFIC_LIGHT_X = 16;export const MAC_TRAFFIC_LIGHT_BASE_Y = 18;const MAC_TRAFFIC_LIGHT_SCALE_DELTA_Y = 20;const MAC_TRAFFIC_LIGHT_RESERVED_INSET = 70;+const APP_SHELL_MIN_WIDTH_PX = 760;+const APP_SHELL_MIN_HEIGHT_PX = 600;function normalizeTrafficLightUiScale(scale: number): number {return Number.isFinite(scale) ? Math.min(MAX_UI_SCALE, Math.max(MIN_UI_SCALE, scale)) : 1;@@ -28,6 +30,23 @@ export function macTrafficLightInsetPaddingForScale(scale: number): string {return `${Math.ceil(MAC_TRAFFIC_LIGHT_RESERVED_INSET / normalizedScale)}px`;}+/**+ * 应用外壳(data-app-shell)的最小可用尺寸。+ *+ * webview 缩放是重排式的(pageZoom / ZoomFactor):倍率越大 CSS 视口越小,+ * 因此 760x600 的最小可用尺寸必须以 *视觉* 像素为基准,换算成 CSS 像素时+ * 除以实际倍率——固定 CSS 下限会在约 窗口高/600 的倍率后超出视口,把应用+ * 底部(如设置页脚按钮)挤出窗口导致无法点击。100% 缩放时输出与 760x600+ * 完全一致,保留 fix(desktop): prevent scaled window clipping 的保护。+ */+export function appShellMinSizeStyleForScale(scale: number): { minWidth: string; minHeight: string } {+ const normalizedScale = Number.isFinite(scale) && scale > 0 ? scale : 1;+ return {+ minWidth: `${Math.ceil(APP_SHELL_MIN_WIDTH_PX / normalizedScale)}px`,+ minHeight: `${Math.ceil(APP_SHELL_MIN_HEIGHT_PX / normalizedScale)}px`,+ };+}+export function shouldReserveMacTrafficLightInset(isMac: boolean, isFullscreen: boolean, isDesktop = true): boolean {return isDesktop && isMac && !isFullscreen;}