feat(ui): 新窗口打开落地即进文件树,调换行内按钮顺序

- 行内按钮改为删除在最右、新窗口在它左边(误触删除的概率更低)
- 会话行新窗口链接带 files=1,打开会话后把侧栏切到文件树,省一次点击
- 手机端本来就不显示行内按钮(hover:hover + pointer:fine),窄屏 setDrawerPane 也会拒绝切文件树
This commit is contained in:
2026-11-13 09:25:22 +08:00
parent e50015cdc1
commit 65d05d2656
3 changed files with 17 additions and 5 deletions
+2 -2
View File
@@ -1027,8 +1027,8 @@ body.voice-active .scroll-bottom-btn { display: none; }
color: var(--gray); background: var(--surface); border: 1px solid var(--border);
z-index: 2;
}
.conv-pop { right: 8px; }
.conv-del { right: 36px; }
.conv-pop { right: 36px; }
.conv-del { right: 8px; }
@media (hover: hover) and (pointer: fine) {
.conv-wrap:hover .conv-item:not(.active) { background: #f5f6f8; }
/* hover 时标题让出右侧按钮位,防两个按钮压住文字 */
+6 -1
View File
@@ -1095,7 +1095,12 @@
$('drawer-list').addEventListener('click', e => {
// 桌面端 hover 行内按钮:先于打开会话处理
const popBtn = e.target.closest('.conv-pop');
if (popBtn) { e.stopPropagation(); window.open('/?s=' + encodeURIComponent(popBtn.dataset.pop), '_blank', 'noopener'); return; }
if (popBtn) {
e.stopPropagation();
// files=1 让新窗口开局直接把侧栏切到文件树(打开后即被 syncUrl 抹掉)
window.open('/?s=' + encodeURIComponent(popBtn.dataset.pop) + '&files=1', '_blank', 'noopener');
return;
}
// 删除按钮:点击弹删除确认 modal
const delBtn = e.target.closest('.conv-del');
if (delBtn) { e.stopPropagation(); deleteSession(delBtn.dataset.del); return; }
+9 -2
View File
@@ -2087,6 +2087,13 @@
// 会话深链 /?s=<session_id>:数据页面(/app/{task_id}/...)的「返回会话」FAB 用——
// task_id 即会话 id(engine 里 1:1)。地址栏常驻 ?s= 不抹掉,刷新/收藏/分享都能回到同一会话;
// 会话已删时 openSession 会自己回落到 welcome 并把 URL 清回 /。
const deep = new URLSearchParams(location.search).get('s');
if (deep) openSession(deep);
const params = new URLSearchParams(location.search);
const deep = params.get('s');
if (deep) {
openSession(deep).then(() => {
// 从侧栏「在新窗口打开」进来(带 files=1):开局直接把侧栏切到文件树;
// 窄屏/无会话/文件树未加载时 setDrawerPane 内部会自行忽略
if (params.get('files') === '1' && typeof setDrawerPane === 'function') setDrawerPane(true);
});
}
})();