fix: bind popup drop title, move unbind into row, toggle session list
This commit is contained in:
@@ -1963,7 +1963,6 @@ function buildCustomLayoutPrompt(req: string): string {
|
||||
{bindPick && <div className="dsh-wt_popBackdrop" style={{ zIndex: 83 }} onClick={() => { setBindPick(null); setBindListOpen(false) }} />}
|
||||
{bindPick && (
|
||||
<div className="dsh-wt_menu dsh-wt_pop dsh-wt_bindPop" style={{ position: 'fixed', left: bindPick.x, top: bindPick.y, width: 280, zIndex: 84 }}>
|
||||
<span className="dsh-wt_menuLabel">{t('bind.title')}</span>
|
||||
{/* 项目文件夹框(格式基准):第一行 emoji+标题,第二行路径;可随时更改 */}
|
||||
<div className="dsh-wt_bindFolderBox">
|
||||
<div className="dsh-wt_bindFolderRow">
|
||||
@@ -1974,23 +1973,26 @@ function buildCustomLayoutPrompt(req: string): string {
|
||||
{projects.folders[bindPick.id] ?? t('bind.folderNone')}
|
||||
</div>
|
||||
</div>
|
||||
{/* 绑定对话框(与项目文件夹同格式):第一行 💬+标题;第二行 分组 | 对话名(点击右侧弹列表);框内下方:说明 + 解绑 */}
|
||||
{/* 绑定对话框(与项目文件夹同格式):第一行 💬+标题(最右解绑);第二行 分组 | 对话名(点击右侧弹列表,再点反选收起);框内下方:说明 */}
|
||||
<div className="dsh-wt_bindFolderBox">
|
||||
<div className="dsh-wt_bindFolderRow">
|
||||
<span className="dsh-wt_bindFolderLabel">💬 {t('bind.title')}</span>
|
||||
{projects.bindings[bindPick.id] && (
|
||||
<button type="button" className="dsh-wt_bindUnbind" onClick={() => setProjectBinding(bindPick.id, null)}>{t('bind.unbind')} ✕</button>
|
||||
)}
|
||||
</div>
|
||||
{(() => {
|
||||
const sid = projects.bindings[bindPick.id]
|
||||
if (!sid) {
|
||||
return (
|
||||
<button type="button" className="dsh-wt_bindConvRow dsh-wt_bindConvRowNone" title={t('bind.tipUnbound')} onClick={() => setBindListOpen(true)}>
|
||||
<button type="button" className="dsh-wt_bindConvRow dsh-wt_bindConvRowNone" title={t('bind.tipUnbound')} onClick={() => setBindListOpen((v) => !v)}>
|
||||
<span className="dsh-wt_bindNoneText">{t('bind.unbound')} · {t('bind.clickPick')}</span>
|
||||
</button>
|
||||
)
|
||||
}
|
||||
const info = bindInfoOf(bindGroups, sid)
|
||||
return (
|
||||
<button type="button" className="dsh-wt_bindConvRow" title={t('bind.tipBound', { name: info.title })} onClick={() => setBindListOpen(true)}>
|
||||
<button type="button" className="dsh-wt_bindConvRow" title={t('bind.tipBound', { name: info.title })} onClick={() => setBindListOpen((v) => !v)}>
|
||||
<span className="dsh-wt_bindFolder" title={info.folder}>📂 {info.folder}</span>
|
||||
<span className="dsh-wt_bindSep" aria-hidden>|</span>
|
||||
<span className="dsh-wt_bindConvName" title={info.title}>{info.title}</span>
|
||||
@@ -1999,9 +2001,6 @@ function buildCustomLayoutPrompt(req: string): string {
|
||||
)
|
||||
})()}
|
||||
<p className="dsh-wt_bindHint">{t('bind.hint')}</p>
|
||||
{projects.bindings[bindPick.id] && (
|
||||
<button type="button" className="dsh-wt_bindUnbind" onClick={() => setProjectBinding(bindPick.id, null)}>{t('bind.unbind')} ✕</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -276,7 +276,7 @@ export const css = xtermCss + '\n' + [
|
||||
'.dsh-wt_bindHint{margin:6px 0 2px;font-size:11px;line-height:16px;color:var(--dsw-alias-label-secondary,#9aa4b2)}',
|
||||
// 自定义窗完成页:自动绑定提示
|
||||
'.dsh-wt_customDoneBind{margin:6px 0 0;font-size:11px;line-height:16px;color:var(--dsw-alias-state-accent-primary,#4f8ef7)}',
|
||||
'.dsh-wt_bindUnbind{display:inline-flex;align-items:center;gap:4px;margin:4px 0 0;padding:3px 8px;border:1px solid var(--dsw-alias-border-l1,#262b36);border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary,#9aa4b2);font:inherit;font-size:11px;line-height:16px;cursor:pointer}',
|
||||
'.dsh-wt_bindUnbind{flex:none;display:inline-flex;align-items:center;gap:4px;padding:1px 8px;border:1px solid var(--dsw-alias-border-l1,#262b36);border-radius:5px;background:transparent;color:var(--dsw-alias-label-secondary,#9aa4b2);font:inherit;font-size:11px;line-height:16px;cursor:pointer}',
|
||||
'.dsh-wt_bindUnbind:hover{color:var(--dsw-alias-state-danger,#f85149);border-color:var(--dsw-alias-state-danger,#f85149)}',
|
||||
'.dsh-wt_bindList{max-height:280px;overflow:auto;position:static}',
|
||||
'.dsh-wt_bindListPop{display:flex;flex-direction:column;padding:6px}',
|
||||
|
||||
@@ -1119,3 +1119,17 @@
|
||||
点行右侧弹列表(listOnRight、23 项)✓;选后列表收起、主弹窗显示新绑定(名称/▾/解绑)✓;
|
||||
解绑回未绑定态 ✓;backdrop 关闭 ✓;functional-diag 全 20 STEP ERROR_COUNT: 0。
|
||||
- 备注:纯客户端改动,F5 即生效。
|
||||
|
||||
## 补记(绑定弹窗微调:去弹窗标题 + 解绑入行右对齐 + 列表反选收起)
|
||||
|
||||
- 用户反馈:① 两个框标题字号是否一致——实测两处同为 12px(同一 .dsh-wt_bindFolderLabel
|
||||
类),探针加 fontSame 断言锁定;② 弹窗左上角「绑定对话」四字标题去掉(弹窗不止绑定
|
||||
对话,还有项目文件夹);③ 点「绑定对话」行弹出右侧列表后,再点一下反选收起(toggle);
|
||||
④ 解绑按钮放到 💬 绑定对话第一行最右(与 更改 同排右对齐格式)。
|
||||
- 实现:bindPop 删 menuLabel;bindUnbind 移入绑定框第一行(flex:none、与 folderChange 同款
|
||||
紧凑样式,保留 danger hover);两处 bindConvRow onClick 改 setBindListOpen(v => !v);
|
||||
解绑按钮不再占用框内下方。
|
||||
- 验证(probe-batch15.cjs 更新):popTitleGone ✓、fontSame(12px/12px)✓、列表开→再点
|
||||
收起(toggledClosed)且主弹窗保持 ✓、unbindInRow1/RightAligned ✓;functional-diag
|
||||
全 20 STEP ERROR_COUNT: 0。
|
||||
- 备注:纯客户端改动,F5 即生效。
|
||||
|
||||
@@ -61,12 +61,18 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
out.box1Label = boxes[1] ? boxes[1].querySelector('.dsh-wt_bindFolderLabel').textContent : null;
|
||||
out.box0Path = boxes[0] ? boxes[0].querySelector('.dsh-wt_bindFolderPath').textContent : null;
|
||||
out.box0Change = !!(boxes[0] && boxes[0].querySelector('.dsh-wt_bindFolderChange'));
|
||||
// 弹窗左上角不再有「绑定对话」标题;两个框标题字号一致
|
||||
out.popTitleGone = !pop.querySelector('.dsh-wt_menuLabel');
|
||||
var lb0 = boxes[0] && boxes[0].querySelector('.dsh-wt_bindFolderLabel');
|
||||
var lb1 = boxes[1] && boxes[1].querySelector('.dsh-wt_bindFolderLabel');
|
||||
out.fontSizes = { folder: lb0 ? getComputedStyle(lb0).fontSize : null, bind: lb1 ? getComputedStyle(lb1).fontSize : null };
|
||||
out.fontSame = !!(lb0 && lb1 && getComputedStyle(lb0).fontSize === getComputedStyle(lb1).fontSize);
|
||||
// 未绑定态:行显示 未绑定对话·点击选择;无解绑;无右侧列表
|
||||
var rowNone = boxes[1] && boxes[1].querySelector('.dsh-wt_bindConvRow');
|
||||
out.unboundRow = rowNone ? rowNone.textContent : null;
|
||||
out.unbindAbsent = !pop.querySelector('.dsh-wt_bindUnbind');
|
||||
out.listClosed0 = !vis('.dsh-wt_bindListPop');
|
||||
// 点击行 → 右侧弹列表
|
||||
// 点击行 → 右侧弹列表;再点一下 → 反选收起
|
||||
if (rowNone) { rowNone.dispatchEvent(new MouseEvent('click', {bubbles:true, cancelable:true})); }
|
||||
await sleep(400);
|
||||
var lpop = vis('.dsh-wt_bindListPop');
|
||||
@@ -76,7 +82,15 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
out.debug = { prLeft: Math.round(pr.left), prRight: Math.round(pr.right), lrLeft: Math.round(lr.left), innerW: window.innerWidth };
|
||||
out.listOnRight = lr.left >= pr.right - 1;
|
||||
out.itemCount = lpop.querySelectorAll('.dsh-wt_selectItem').length;
|
||||
var item = lpop.querySelector('.dsh-wt_selectItem');
|
||||
var rowNow = vis('.dsh-wt_bindPop .dsh-wt_bindConvRow');
|
||||
if (rowNow) { rowNow.dispatchEvent(new MouseEvent('click', {bubbles:true, cancelable:true})); }
|
||||
await sleep(400);
|
||||
out.toggledClosed = !vis('.dsh-wt_bindListPop');
|
||||
out.mainOpenAfterToggle = !!vis('.dsh-wt_bindPop');
|
||||
if (rowNow) { rowNow.dispatchEvent(new MouseEvent('click', {bubbles:true, cancelable:true})); }
|
||||
await sleep(400);
|
||||
lpop = vis('.dsh-wt_bindListPop');
|
||||
var item = lpop && lpop.querySelector('.dsh-wt_selectItem');
|
||||
if (item) { item.dispatchEvent(new MouseEvent('click', {bubbles:true, cancelable:true})); }
|
||||
await sleep(400);
|
||||
}
|
||||
@@ -87,6 +101,14 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
out.boundFolderText = vis('.dsh-wt_bindPop .dsh-wt_bindFolder') ? vis('.dsh-wt_bindPop .dsh-wt_bindFolder').textContent : null;
|
||||
out.chevron = !!vis('.dsh-wt_bindPop .dsh-wt_bindConvChevron');
|
||||
out.unbindPresent = !!vis('.dsh-wt_bindPop .dsh-wt_bindUnbind');
|
||||
// 解绑按钮在第一行最右(与 💬 绑定对话 同一行右对齐)
|
||||
var ubRow = vis('.dsh-wt_bindPop .dsh-wt_bindUnbind');
|
||||
if (ubRow) {
|
||||
var row1 = boxes[1].querySelector('.dsh-wt_bindFolderRow');
|
||||
var rr = row1.getBoundingClientRect(); var ur = ubRow.getBoundingClientRect();
|
||||
out.unbindInRow1 = row1.contains(ubRow);
|
||||
out.unbindRightAligned = (rr.right - ur.right) < 16;
|
||||
}
|
||||
var saved = JSON.parse(localStorage.getItem('dsh.worktable.projects.v1'));
|
||||
out.savedBinding = saved.bindings['t-bind'];
|
||||
// 解绑 → 恢复未绑定
|
||||
|
||||
Reference in New Issue
Block a user