From 7136adcaa98448d67daea2417ef6bb54d9634a2d Mon Sep 17 00:00:00 2001 From: dekun Date: Thu, 30 Jul 2026 13:15:22 +0800 Subject: [PATCH] Widen settings forms and fix Token clipboard copy fallback. Co-authored-by: Cursor --- control/frontend/src/pages/Settings.tsx | 38 ++++++++++++++++++++++--- control/frontend/src/styles.css | 13 ++++++++- 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/control/frontend/src/pages/Settings.tsx b/control/frontend/src/pages/Settings.tsx index 2f7a6df..8fed0b9 100644 --- a/control/frontend/src/pages/Settings.tsx +++ b/control/frontend/src/pages/Settings.tsx @@ -150,6 +150,39 @@ export default function SettingsPage() { } } + async function copyToken(text: string) { + setErr(""); + setOk(""); + try { + if (navigator.clipboard?.writeText) { + await navigator.clipboard.writeText(text); + setOk("已复制到剪贴板"); + return; + } + } catch { + /* fall through to legacy copy */ + } + try { + const ta = document.createElement("textarea"); + ta.value = text; + ta.setAttribute("readonly", ""); + ta.style.position = "fixed"; + ta.style.left = "-9999px"; + document.body.appendChild(ta); + ta.select(); + ta.setSelectionRange(0, text.length); + const okCopy = document.execCommand("copy"); + document.body.removeChild(ta); + if (okCopy) { + setOk("已复制到剪贴板"); + return; + } + } catch { + /* ignore */ + } + setErr("复制失败,请手动选中 Token 复制"); + } + return (

系统设置

@@ -297,10 +330,7 @@ export default function SettingsPage() { diff --git a/control/frontend/src/styles.css b/control/frontend/src/styles.css index f3fe1fc..6285986 100644 --- a/control/frontend/src/styles.css +++ b/control/frontend/src/styles.css @@ -277,7 +277,8 @@ input { display: grid; gap: 10px; margin: 16px 0; - max-width: 520px; + width: 100%; + box-sizing: border-box; } .table-wrap { @@ -315,6 +316,16 @@ td { gap: 8px; margin: 12px 0; word-break: break-all; + width: 100%; + box-sizing: border-box; +} + +.token-box code { + user-select: all; + display: block; + padding: 8px; + background: #0d1520; + border-radius: 6px; } .settings-tabs {