fix: align resident project cards' own arrows vertically (bridge-injected class)
This commit is contained in:
@@ -1168,6 +1168,10 @@ function buildCustomLayoutPrompt(req: string): string {
|
|||||||
bindBtn.setAttribute('data-wt-bind', id)
|
bindBtn.setAttribute('data-wt-bind', id)
|
||||||
const bound = projects.bindings[id]
|
const bound = projects.bindings[id]
|
||||||
bindBtn.setAttribute('data-bound', bound ? 'true' : 'false')
|
bindBtn.setAttribute('data-bound', bound ? 'true' : 'false')
|
||||||
|
// 入驻卡自带箭头(文本 ›):加统一对齐类,视觉居中(字面框偏下补偿 1px)
|
||||||
|
const kids = Array.from(el.children)
|
||||||
|
const arrow = kids.find((k: any) => k.tagName === 'SPAN' && String((k as HTMLElement).textContent ?? '').trim() === '›')
|
||||||
|
if (arrow) (arrow as HTMLElement).classList.add('dsh-wt_resArrow')
|
||||||
const tip = bound ? t('bind.tipBound', { name: boundSessionTitle(bound) }) : t('bind.tipUnbound')
|
const tip = bound ? t('bind.tipBound', { name: boundSessionTitle(bound) }) : t('bind.tipUnbound')
|
||||||
bindBtn.setAttribute('data-tip', tip)
|
bindBtn.setAttribute('data-tip', tip)
|
||||||
bindBtn.setAttribute('aria-label', tip)
|
bindBtn.setAttribute('aria-label', tip)
|
||||||
|
|||||||
@@ -177,6 +177,8 @@ export const css = [
|
|||||||
'.dsh-wt_layoutName{font-size:12px;font-weight:400;line-height:17px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
|
'.dsh-wt_layoutName{font-size:12px;font-weight:400;line-height:17px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
|
||||||
// 箭头与项目名同一行高 + 字面中心对齐;› 墨迹在字面框内偏下,整体上移 1px 使视觉居中
|
// 箭头与项目名同一行高 + 字面中心对齐;› 墨迹在字面框内偏下,整体上移 1px 使视觉居中
|
||||||
'.dsh-wt_layoutArrow{flex:none;display:inline-flex;align-items:center;height:18px;color:var(--dsw-alias-label-tertiary,#6e7683);font-size:14px;line-height:18px;transform:translateY(-1px)}',
|
'.dsh-wt_layoutArrow{flex:none;display:inline-flex;align-items:center;height:18px;color:var(--dsw-alias-label-tertiary,#6e7683);font-size:14px;line-height:18px;transform:translateY(-1px)}',
|
||||||
|
// 入驻项目卡自带箭头(桥注入 .dsh-wt_resArrow):与布局卡同款视觉居中
|
||||||
|
'button[data-wt-id] > .dsh-wt_resArrow{display:inline-flex;align-items:center;height:18px;line-height:18px;transform:translateY(-1px)}',
|
||||||
// 项目卡片统一:所有入驻项目卡片(data-wt-id 通用标记)与布局卡片同款常显框
|
// 项目卡片统一:所有入驻项目卡片(data-wt-id 通用标记)与布局卡片同款常显框
|
||||||
'.dsh-wt_projects [data-wt-id]{border-color:var(--dsw-alias-border-l1,#262b36);background:var(--dsw-alias-fill-l1,rgba(255,255,255,.02))}',
|
'.dsh-wt_projects [data-wt-id]{border-color:var(--dsw-alias-border-l1,#262b36);background:var(--dsw-alias-fill-l1,rgba(255,255,255,.02))}',
|
||||||
'.dsh-wt_projects [data-wt-id]:hover{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05))}',
|
'.dsh-wt_projects [data-wt-id]:hover{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05))}',
|
||||||
|
|||||||
@@ -833,6 +833,18 @@
|
|||||||
- 验证:functional-diag ERROR_COUNT: 0。
|
- 验证:functional-diag ERROR_COUNT: 0。
|
||||||
- 备注:纯客户端改动,F5 即生效。
|
- 备注:纯客户端改动,F5 即生效。
|
||||||
|
|
||||||
|
## 补记(箭头对齐正主:入驻项目卡自带箭头)
|
||||||
|
|
||||||
|
- 用户反馈:箭头两次改动「没动」——原因:用户看的是入驻项目卡(旅行 Atlas / 建筑审图)
|
||||||
|
自己的 › 箭头(.ta_cardArrow / .pr_cardArrow),此前两轮改的是布局卡 .dsh-wt_layoutArrow。
|
||||||
|
- 处理:桥注入时给入驻卡文本为 › 的 span 子元素加 .dsh-wt_resArrow 类(通用,不限具体卡片),
|
||||||
|
CSS:button[data-wt-id] > .dsh-wt_resArrow = 18px 行高 + inline-flex 居中 + translateY(-1px)
|
||||||
|
(字面框偏下补偿,与布局卡同款)。
|
||||||
|
- 验证(carddom-mini.cjs):ta/pr 箭头均注入 dsh-wt_resArrow、h=20→18px、字面中心高于
|
||||||
|
卡片中心 1.5px(墨迹视觉居中);functional-diag ERROR_COUNT: 0。
|
||||||
|
- 备注:纯客户端改动,F5 即生效;代理已恢复,积压提交已全部推送。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
// carddom-mini.cjs — 打印入驻卡与布局卡的子元素结构,找箭头
|
||||||
|
const http = require('http');
|
||||||
|
const { spawn } = require('child_process');
|
||||||
|
const WebSocket = require('ws');
|
||||||
|
const PORT = 9348;
|
||||||
|
const proc = spawn('C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe', [
|
||||||
|
'--headless=new', '--disable-gpu', '--no-first-run', '--no-default-browser-check',
|
||||||
|
'--window-size=1440,900', '--force-device-scale-factor=1',
|
||||||
|
'--remote-debugging-port=' + PORT,
|
||||||
|
'--user-data-dir=C:\\Users\\SJL\\AppData\\Local\\Temp\\wt-chrome-carddom',
|
||||||
|
'about:blank',
|
||||||
|
], { stdio: 'ignore' });
|
||||||
|
const getJSON = (p) => new Promise((res, rej) => {
|
||||||
|
http.get({ host: '127.0.0.1', port: PORT, path: p }, (r) => { let d=''; r.on('data',c=>d+=c); r.on('end',()=>{try{res(JSON.parse(d))}catch(e){rej(e)}}) }).on('error', rej);
|
||||||
|
});
|
||||||
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||||
|
(async () => {
|
||||||
|
let list = null;
|
||||||
|
for (let i = 0; i < 40; i++) { try { list = await getJSON('/json/list'); if (list && list.length) break; } catch {} await sleep(500); }
|
||||||
|
const target = list.find((t) => t.type === 'page') || list[0];
|
||||||
|
const ws = new WebSocket(target.webSocketDebuggerUrl);
|
||||||
|
let id = 0; const pending = new Map();
|
||||||
|
const send = (method, params) => new Promise((res) => { const mid = ++id; pending.set(mid, res); ws.send(JSON.stringify({ id: mid, method, params })); });
|
||||||
|
ws.on('message', (raw) => { const m = JSON.parse(String(raw)); if (m.id && pending.has(m.id)) { pending.get(m.id)(m); pending.delete(m.id); } });
|
||||||
|
await new Promise((r) => ws.on('open', r));
|
||||||
|
await send('Runtime.enable');
|
||||||
|
await send('Page.enable');
|
||||||
|
await send('Page.addScriptToEvaluateOnNewDocument', {
|
||||||
|
source: "try{ if(window===window.top && location.origin==='http://127.0.0.1:3080'){ localStorage.setItem('dsh.worktable.projects.v1', JSON.stringify({order:[],lastUsed:{},hidden:[],nameOverrides:{},shortcuts:[],layouts:[{id:'t-layout',title:'L',top:null,left:null,main:[{id:'p1',title:'W',min:200,content:null}],chatWidth:{default:320,min:240,max:600},chatSide:'right',chatFullHeight:false}],bindings:{}})); } }catch(e){}",
|
||||||
|
});
|
||||||
|
await send('Page.navigate', { url: 'http://127.0.0.1:3080/' });
|
||||||
|
const evaluate = async (expr) => {
|
||||||
|
const r = await send('Runtime.evaluate', { expression: expr, returnByValue: true, awaitPromise: true });
|
||||||
|
if (r.result && r.result.exceptionDetails) return { __error: (r.result.exceptionDetails.exception || {}).description || r.result.exceptionDetails.text };
|
||||||
|
return r.result && r.result.result ? r.result.result.value : undefined;
|
||||||
|
};
|
||||||
|
let ready = null;
|
||||||
|
for (let i = 0; i < 30; i++) { await sleep(1000); ready = await evaluate("!!window.__dshWorktable"); if (ready === true) break; }
|
||||||
|
await sleep(1800);
|
||||||
|
const step = await evaluate(`(function(){
|
||||||
|
var out = {};
|
||||||
|
var dump = function(card){
|
||||||
|
var kids = [];
|
||||||
|
[].slice.call(card.children).forEach(function(el){
|
||||||
|
var r = el.getBoundingClientRect();
|
||||||
|
kids.push({ tag: el.tagName, cls: String(el.className).slice(0, 60), text: String(el.textContent).trim().slice(0, 12), x: Math.round(r.x), y: Math.round(r.y), w: Math.round(r.width), h: Math.round(r.height), lineH: getComputedStyle(el).lineHeight, fs: getComputedStyle(el).fontSize });
|
||||||
|
});
|
||||||
|
return kids;
|
||||||
|
};
|
||||||
|
var ta = document.querySelector('.dsh-wt_projects .ta_card') || document.querySelector('.ta_card');
|
||||||
|
var pr = document.querySelector('.dsh-wt_projects .pr_card') || document.querySelector('.pr_card');
|
||||||
|
var lay = document.querySelector('.dsh-wt_projects .dsh-wt_layout');
|
||||||
|
out.taExists = !!ta; out.prExists = !!pr; out.layExists = !!lay;
|
||||||
|
var centerOf = function(r){ return (r.top + r.bottom) / 2; };
|
||||||
|
var measureArrow = function(card){
|
||||||
|
var a = card.querySelector('.dsh-wt_resArrow') || card.querySelector('.ta_cardArrow') || card.querySelector('.pr_cardArrow');
|
||||||
|
if (!a) return null;
|
||||||
|
var cr = card.getBoundingClientRect();
|
||||||
|
var range = document.createRange();
|
||||||
|
range.selectNodeContents(a);
|
||||||
|
var ar = range.getBoundingClientRect();
|
||||||
|
return { cls: String(a.className).slice(0,40), glyphCenter: Math.round(centerOf(ar)*10)/10, cardCenter: Math.round(centerOf(cr)*10)/10, delta: Math.round((centerOf(ar)-centerOf(cr))*10)/10 };
|
||||||
|
};
|
||||||
|
out.taArrow = measureArrow(ta);
|
||||||
|
out.prArrow = measureArrow(pr);
|
||||||
|
out.layArrow = measureArrow(lay);
|
||||||
|
if (ta) { var r = ta.getBoundingClientRect(); out.taRect = { top: Math.round(r.top), h: Math.round(r.height), center: Math.round(r.top + r.height/2) }; out.taKids = dump(ta); }
|
||||||
|
if (pr) { var r2 = pr.getBoundingClientRect(); out.prRect = { top: Math.round(r2.top), h: Math.round(r2.height), center: Math.round(r2.top + r2.height/2) }; out.prKids = dump(pr); }
|
||||||
|
if (lay) { var r3 = lay.getBoundingClientRect(); out.layRect = { top: Math.round(r3.top), h: Math.round(r3.height), center: Math.round(r3.top + r3.height/2) }; out.layKids = dump(lay); }
|
||||||
|
return JSON.stringify(out);
|
||||||
|
})()`);
|
||||||
|
console.log('CARDDOM:', JSON.stringify(step));
|
||||||
|
ws.close(); proc.kill(); process.exit(0);
|
||||||
|
})().catch((e) => { console.error('FATAL', e && e.stack || e); try { proc.kill(); } catch {} process.exit(1); });
|
||||||
Reference in New Issue
Block a user