From 9b692b066dc463e4df7365ccf5edad962e96558a Mon Sep 17 00:00:00 2001 From: Dusk Date: Sat, 25 Apr 2026 13:21:25 +0800 Subject: [PATCH] fix(settings): stabilize select border rendering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 中文: 进一步稳定设置页下拉框边框显示,避免 Anki 映射行中的 select 控件在选择后被裁剪。 English: Further stabilize select border rendering in the settings Anki mapping rows after note type selection. --- src/presentation/settings/PluginSettingTab.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/presentation/settings/PluginSettingTab.ts b/src/presentation/settings/PluginSettingTab.ts index 95dcf60..b9181e7 100644 --- a/src/presentation/settings/PluginSettingTab.ts +++ b/src/presentation/settings/PluginSettingTab.ts @@ -278,7 +278,7 @@ export class AnkiHeadingSyncSettingTab extends PluginSettingTab { ankiRow.style.alignItems = "center"; ankiRow.style.columnGap = "16px"; ankiRow.style.rowGap = "8px"; - ankiRow.style.overflow = "hidden"; + ankiRow.style.overflow = "visible"; ankiRow.style.width = "100%"; const noteTypeGroup = this.createGridControlSlot(ankiRow, t("settings.cards.cardTypes.labels.noteType")); @@ -1322,11 +1322,14 @@ export class AnkiHeadingSyncSettingTab extends PluginSettingTab { } private applyFluidEllipsis(element: HTMLElement): void { + const tagName = (element.tagName || (element as unknown as { tag?: string }).tag || "").toLowerCase(); + const isFieldControl = tagName === "select" || tagName === "input"; element.style.boxSizing = "border-box"; - element.style.width = "100%"; - element.style.maxWidth = "100%"; + element.style.width = isFieldControl ? "calc(100% - 2px)" : "100%"; + element.style.maxWidth = isFieldControl ? "calc(100% - 2px)" : "100%"; element.style.minWidth = "0"; - element.style.overflow = "hidden"; + element.style.margin = isFieldControl ? "1px" : "0"; + element.style.overflow = isFieldControl ? "visible" : "hidden"; element.style.textOverflow = "ellipsis"; element.style.whiteSpace = "nowrap"; }