From 3d7efadfe255d577ce7dffe2dbe49fc8c7967722 Mon Sep 17 00:00:00 2001 From: Aisland Date: Thu, 20 Aug 2026 22:21:15 +0800 Subject: [PATCH] feat: add refresh button to browser and anim panes (iframe remount reload) --- 01_content/src/client/locales.ts | 2 + 01_content/src/client/split.tsx | 10 ++- .../worklogs/2026-08-16_worktable-v2.md | 10 +++ 04_test/probe-refresh.cjs | 63 +++++++++++++++++++ 4 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 04_test/probe-refresh.cjs diff --git a/01_content/src/client/locales.ts b/01_content/src/client/locales.ts index fee1d52..54a8699 100644 --- a/01_content/src/client/locales.ts +++ b/01_content/src/client/locales.ts @@ -63,6 +63,7 @@ export const zh = { 'pane.terminal': '终端', 'pane.custom': '自定义', 'pane.anim': '动画', + 'pane.refresh': '刷新', 'pane.animUrlPh': '粘贴动画站点地址后回车', 'custom.title': '自定义这个窗口', 'custom.hint': '发送后将自动新建一个会话,专门负责这个窗口的自定义设计。', @@ -196,6 +197,7 @@ export const en = { 'pane.terminal': 'Terminal', 'pane.custom': 'Custom', 'pane.anim': 'Animation', + 'pane.refresh': 'Refresh', 'pane.animUrlPh': 'Paste the animation site URL and press Enter', 'custom.title': 'Customize this pane', 'custom.hint': 'Sending will create a new conversation dedicated to designing this pane.', diff --git a/01_content/src/client/split.tsx b/01_content/src/client/split.tsx index 49e1860..f18772e 100644 --- a/01_content/src/client/split.tsx +++ b/01_content/src/client/split.tsx @@ -864,10 +864,11 @@ function makeDividerHandler(kind: 'left' | 'chat' | 'top' | 'pane' | 'topPane', } } -/** 浏览器内置窗:地址栏 + iframe */ +/** 浏览器内置窗:地址栏 + 刷新 + iframe(刷新 = 重新挂载 iframe,跨域也可靠) */ function BrowserPane() { const [url, setUrl] = useState('https://example.com') const [src, setSrc] = useState('https://example.com') + const [reloadKey, setReloadKey] = useState(0) const go = () => { const u = url.trim() setSrc(/^(\/|https?:\/\/)/i.test(u) ? u : 'about:blank') @@ -882,9 +883,10 @@ function BrowserPane() { onChange={(e) => setUrl(e.target.value)} onKeyDown={(e) => { if (e.key === 'Enter') go() }} /> + -