diff --git a/app/server/public/css/style.css b/app/server/public/css/style.css
index 598e4d3..6d4cd30 100644
--- a/app/server/public/css/style.css
+++ b/app/server/public/css/style.css
@@ -852,20 +852,57 @@ footer { position: relative; flex: none; padding: 8px 12px calc(10px + env(safe-
/* ================= 全屏查看器(搬自 index;图片单点放大+缩放,消息双击放大) ================= */
#img-viewer { position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,0.93); display: flex; align-items: center; justify-content: center; overflow: hidden; }
#img-viewer.hidden { display: none; }
-#img-viewer-img { max-width: 92vw; max-height: 88vh; touch-action: none; cursor: grab; user-select: none; -webkit-user-drag: none; }
+#img-viewer-img { max-width: 100vw; max-height: 88vh; touch-action: none; cursor: grab; user-select: none; -webkit-user-drag: none; }
#fs-viewer { position: fixed; inset: 0; z-index: 130; background: rgba(8,10,20,0.88); padding: 40px 14px 24px; overflow: auto; /* 缩放后支持横纵滚动 */ }
#fs-viewer.hidden { display: none; }
.fs-panel { max-width: 860px; margin: 0 auto; background: var(--page); border-radius: 14px; padding: 18px 20px; font-size: 15.5px; }
-.fs-close {
- position: fixed; top: 12px; right: 14px; z-index: 131; width: 34px; height: 34px;
- border: none; border-radius: 50%; background: rgba(255,255,255,0.18); color: #fff;
+/* 顶部操作区:默认右上角悬浮(消息全屏用);文件预览走 fs-bar 模式时独立成一行 */
+.fs-actions { position: fixed; top: calc(2px + env(safe-area-inset-top, 0px)); right: 14px; z-index: 131; display: flex; align-items: center; gap: 8px; }
+.fs-name { display: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--ink); }
+.fs-btn {
+ flex: none; display: flex; align-items: center; justify-content: center;
+ width: 34px; height: 34px; border: none; border-radius: 50%;
+ background: rgba(0,0,0,0.42); color: #fff; box-shadow: 0 1px 5px rgba(0,0,0,0.22);
font-size: 15px; line-height: 1; cursor: pointer;
}
-/* 源码切换 eye 钮:与关闭钮同款,居其左;仅当前内容有源文本时显示(setFsSource 控显隐) */
-.fs-eye { right: 58px; display: flex; align-items: center; justify-content: center; }
-.fs-eye svg { width: 17px; height: 17px; }
-.fs-eye.on { background: rgba(255,255,255,0.85); color: #333; }
-/* 源码面板:与 #fs-body 互斥显示(toggleFsSrc 切换);不参与双指缩放逻辑 */
+.fs-btn svg { width: 17px; height: 17px; }
+.fs-btn.on { background: rgba(255,255,255,0.85); color: #333; }
+
+/* 文件预览沉浸模式:40px 操作条 + 全宽内容。内容从条下开始,不会叠在页面自己的顶部按钮上;
+ 宽度一点不让(手机横向最贵),只牺牲一条操作栏的高度。 */
+#fs-viewer.fs-bar { display: flex; flex-direction: column; padding: 0; overflow: auto; background: var(--page); }
+#fs-viewer.fs-bar .fs-actions {
+ position: sticky; top: 0; z-index: 1;
+ flex: none; width: 100%;
+ height: calc(40px + env(safe-area-inset-top, 0px));
+ padding: env(safe-area-inset-top, 0px) 10px 0 14px;
+ justify-content: flex-end; gap: 6px;
+ background: var(--page); border-bottom: 1px solid var(--border);
+}
+#fs-viewer.fs-bar .fs-name { display: block; flex: 1; }
+#fs-viewer.fs-bar .fs-btn { width: 32px; height: 32px; border-radius: 8px; background: transparent; color: var(--ink); box-shadow: none; }
+#fs-viewer.fs-bar .fs-btn:active { background: var(--surface); }
+#fs-viewer.fs-bar .fs-btn.on { background: var(--active); color: #fff; }
+#fs-viewer.fs-bar .fs-panel { flex: 1; min-height: 0; width: 100%; max-width: none; margin: 0; padding: 0; border-radius: 0; background: var(--page); }
+#fs-viewer.fs-bar #fs-body { position: relative; overflow: auto; }
+#fs-viewer.fs-bar #fs-body .fs-html-frame { height: 100%; min-height: 0; border-radius: 0; }
+/* 文本/源码直排:去掉气泡卡片的内外边距,只留 12px 阅读边距 */
+#fs-viewer.fs-bar #fs-body .bubble-ai,
+#fs-viewer.fs-bar #fs-body .bubble-user {
+ max-width: 100%; margin: 0; border-radius: 0; box-shadow: none; background: var(--page);
+ padding: 14px 12px calc(28px + env(safe-area-inset-bottom, 0px)); font-size: 15.5px;
+}
+#fs-viewer.fs-bar #fs-src-pane { overflow: auto; }
+#fs-viewer.fs-bar #fs-src-code { max-height: none; border: 0; border-radius: 0; padding: 12px 14px calc(28px + env(safe-area-inset-bottom, 0px)); }
+#fs-viewer.fs-bar .fs-img-frame { max-width: 100%; max-height: 100%; border-radius: 0; margin: 0 auto; }
+.fs-close {
+ /* 顶到视口最上沿(避开刘海),不再压住预览面板顶部 */
+ position: fixed; top: calc(2px + env(safe-area-inset-top, 0px)); right: 14px; z-index: 131; width: 34px; height: 34px;
+ border: none; border-radius: 50%; background: rgba(0,0,0,0.42); color: #fff;
+ box-shadow: 0 1px 5px rgba(0,0,0,0.22);
+ font-size: 15px; line-height: 1; cursor: pointer;
+}
+/* 源码面板:与 #fs-body 互斥显示(toggleFsSrc 切换);bar 模式下占满操作条以下区域 */
.fs-src-panel { padding: 14px 16px; }
#fs-src-code {
margin: 0; white-space: pre-wrap; word-break: break-word;
diff --git a/app/server/public/index.html b/app/server/public/index.html
index a13c2c5..8c653b1 100644
--- a/app/server/public/index.html
+++ b/app/server/public/index.html
@@ -476,11 +476,20 @@
diff --git a/app/server/public/js/preview.js b/app/server/public/js/preview.js
index 0d8fb0d..7a52d08 100644
--- a/app/server/public/js/preview.js
+++ b/app/server/public/js/preview.js
@@ -107,12 +107,21 @@ function pvCloseDoc() {
}
// 移动端全屏承载:把节点塞进 #fs-viewer 并展开
-function pvOverlayShow(node) {
+// opts.bar → 文件预览沉浸模式:顶部独立操作条,内容全宽占满剩余空间
+// opts.name → 操作条左侧的文件名(仅 bar 模式可见)
+// opts.source → 源文本,交给 eye / 复制钮(未传则两者隐藏)
+function pvOverlayShow(node, opts) {
+ opts = opts || {};
+ const viewer = document.getElementById('fs-viewer');
const body = document.getElementById('fs-body');
+ viewer.classList.toggle('fs-bar', !!opts.bar);
+ const nm = document.getElementById('fs-file-name');
+ nm.textContent = opts.name ? String(opts.name) : '';
+ nm.title = nm.textContent;
body.innerHTML = ''; body.style.zoom = '';
- if (typeof setFsSource === 'function') setFsSource(null);
+ if (typeof setFsSource === 'function') setFsSource(opts.source == null ? null : opts.source);
body.appendChild(node);
- document.getElementById('fs-viewer').classList.remove('hidden');
+ viewer.classList.remove('hidden');
}
// ---------- office:iframe 直挂预览网关(HEAD 预探顺便触发冷槽复活) ----------
@@ -128,7 +137,7 @@ async function pvOpenOffice(name, sizeText) {
document.getElementById('pv-body').appendChild(load); // 开窗即刻可见,冷启动转圈等首帧
} else {
load = pvLoadingBox(); load.classList.add('inline');
- pvOverlayShow(load);
+ pvOverlayShow(load, { bar: true, name: name });
if (!pvState.mobilePush) { try { history.pushState({ pvOffice: 1 }, ''); pvState.mobilePush = true; } catch (_) {} }
}
let head = null;
@@ -179,7 +188,7 @@ async function openFilePreview(name, sizeText) {
pvClearBody(); pvHeader(name, sizeText);
document.getElementById('pv-body').appendChild(node);
pvToolbar(tb || tbAll);
- } else pvOverlayShow(node);
+ } else pvOverlayShow(node, { bar: true, name: name });
};
if (kind === 'none') {
const low = String(name).toLowerCase();
@@ -312,7 +321,7 @@ async function pvTextNode(name, sizeText, r) {
return holder;
}
-// 移动端非 office:保持原全屏行为(#fs-viewer)
+// 移动端非 office:统一走 #fs-viewer 沉浸式(顶部操作条 + 全宽内容)
async function pvRenderLegacy(name, r, my) {
if (/\.html?$/i.test(name)) {
const html = await r.text();
@@ -320,8 +329,7 @@ async function pvRenderLegacy(name, r, my) {
iframe.className = 'fs-html-frame';
iframe.setAttribute('sandbox', 'allow-same-origin allow-scripts');
iframe.srcdoc = rewriteHtmlDocSrcs(html, name);
- pvOverlayShow(iframe);
- setFsSource(html); // 源码钮可看页面原码
+ pvOverlayShow(iframe, { bar: true, name: name, source: html }); // 全宽沉浸,源码可看/可复制
if (my !== pvSeq) return;
} else if (/\.pdf$/i.test(name)) {
const u = URL.createObjectURL(await r.blob());
@@ -331,7 +339,17 @@ async function pvRenderLegacy(name, r, my) {
frame.className = 'fs-html-frame';
frame.title = name;
frame.src = u;
- pvOverlayShow(frame);
+ pvOverlayShow(frame, { bar: true, name: name });
+ } else if (/\.svg$/i.test(name)) {
+ // SVG 当图片显示(
不执行内嵌脚本),同时保留源码给 eye/复制钮
+ const text = await r.text();
+ const u = URL.createObjectURL(new Blob([text], { type: 'image/svg+xml;charset=utf-8' }));
+ if (state.lastImgBlobUrl) { try { URL.revokeObjectURL(state.lastImgBlobUrl); } catch (_) {} }
+ state.lastImgBlobUrl = u;
+ const im = document.createElement('img');
+ im.className = 'fs-img-frame'; im.src = u; im.alt = String(name);
+ im.addEventListener('click', () => openImageViewer(u, String(name).split('/').pop()));
+ pvOverlayShow(im, { bar: true, name: name, source: text });
} else if (PV_IMG.test(name)) {
const u = URL.createObjectURL(await r.blob());
if (state.lastImgBlobUrl) { try { URL.revokeObjectURL(state.lastImgBlobUrl); } catch (_) {} }
@@ -352,7 +370,7 @@ async function pvRenderLegacy(name, r, my) {
wrap.className = 'msg other';
wrap.innerHTML = '' + html + '
';
decorateCodePre(wrap);
- openFullscreen(wrap.firstChild, text); // 文件原文供 eye 钮看源码
+ pvOverlayShow(wrap.firstChild, { bar: true, name: name, source: text }); // 全宽沉浸,eye/复制看原文
}
}
diff --git a/app/server/public/js/stream.js b/app/server/public/js/stream.js
index aaf5c13..6dd6f84 100644
--- a/app/server/public/js/stream.js
+++ b/app/server/public/js/stream.js
@@ -527,6 +527,8 @@
btn.classList.remove('on');
btn.title = '显示源码';
btn.setAttribute('aria-label', '显示源码');
+ // 复制钮与 eye 同显隐:有源码才可复制
+ $('fs-copy-btn').classList.toggle('hidden', fsSrcText == null);
}
function toggleFsSrc() {
if (fsSrcText == null) return;
@@ -541,8 +543,15 @@
btn.setAttribute('aria-label', lbl);
}
$('fs-src-btn').addEventListener('click', toggleFsSrc);
+ // 复制源码:HTML/SVG/MD/代码通用,拿到的就是 eye 面板里那份文本
+ $('fs-copy-btn').addEventListener('click', async () => {
+ if (fsSrcText == null) return;
+ const ok = await copyText(fsSrcText);
+ toast(ok ? '已复制' : '复制失败');
+ });
function openFullscreen(el, src) {
+ $('fs-viewer').classList.remove('fs-bar'); // 消息全屏沿用悬浮按钮,清掉文件预览的栏模式
const body = $('fs-body');
body.innerHTML = '';
body.style.zoom = '';
@@ -566,6 +575,7 @@
}
function closeFullscreen() {
setFsSource(null); // 顺手收起源码面板/隐藏 eye 钮,下轮打开不残留
+ $('fs-viewer').classList.remove('fs-bar');
$('fs-viewer').classList.add('hidden');
$('fs-viewer').dispatchEvent(new Event('fs:close'));
}