release: dsh-sansheng-liubu v0.1.3 (package at repo root)
修复点击左侧入口右侧工作台不出现:openTab 后聚焦并展开右栏;无法确认页签时回退浮动面板;整行点击兜底在主区渲染工作台。
This commit is contained in:
parent
06ea2fa6cf
commit
74c1a9c82d
48
client.js
48
client.js
|
|
@ -1004,7 +1004,24 @@ function apply(ctx) {
|
|||
}
|
||||
function ensureRightTab() {
|
||||
const tabs = get("sidebarRightTabs");
|
||||
return !!(tabs && isFn(tabs.get) && tabs.get(TAB_KIND));
|
||||
if (!tabs || !isFn(tabs.get)) return false;
|
||||
try {
|
||||
return !!(tabs.get(TAB_KIND) || tabs.get(TAB_TYPE_ID));
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function revealRightTab() {
|
||||
const right = get("sidebarRight");
|
||||
if (!right) return;
|
||||
try {
|
||||
const rows = isFn(right.openTabs?.getSnapshot) ? right.openTabs.getSnapshot() : [];
|
||||
const row = Array.isArray(rows) ? rows.find((item) => item && item.kind === TAB_KIND) : null;
|
||||
if (row && isFn(right.focus)) right.focus(row.tabId);
|
||||
if (isFn(right.isExpanded) && !right.isExpanded() && isFn(right.toggleExpanded)) right.toggleExpanded();
|
||||
} catch (error) {
|
||||
console.warn("[sansheng] 展开右侧栏失败:", error && error.message ? error.message : error);
|
||||
}
|
||||
}
|
||||
function tryOpenRightTab() {
|
||||
const right = get("sidebarRight");
|
||||
|
|
@ -1012,11 +1029,17 @@ function apply(ctx) {
|
|||
if (!ensureRightTab()) return false;
|
||||
try {
|
||||
right.openTab(TAB_KIND);
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.warn("[sansheng] 打开右侧标签失败,改用浮动面板:", error && error.message ? error.message : error);
|
||||
return false;
|
||||
}
|
||||
revealRightTab();
|
||||
try {
|
||||
const rows = isFn(right.openTabs?.getSnapshot) ? right.openTabs.getSnapshot() : null;
|
||||
if (Array.isArray(rows) && rows.length > 0 && !rows.some((item) => item && item.kind === TAB_KIND)) return false;
|
||||
} catch {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function SanshengTabBody() {
|
||||
return (0, import_react.createElement)("div", { className: "ssw-tab-body" }, (0, import_react.createElement)(SanshengWorkbench, {}));
|
||||
|
|
@ -1441,8 +1464,12 @@ function apply(ctx) {
|
|||
);
|
||||
}
|
||||
function SanshengNavFallback() {
|
||||
const [mode, setMode] = (0, import_react.useState)("pending");
|
||||
(0, import_react.useEffect)(() => {
|
||||
openRightWorkbench();
|
||||
setMode(openRightWorkbench() ? "docked" : "inline");
|
||||
}, []);
|
||||
(0, import_react.useEffect)(() => {
|
||||
if (mode !== "docked") return;
|
||||
const layout = get("layout");
|
||||
if (layout && isFn(layout.selectPanel)) {
|
||||
try {
|
||||
|
|
@ -1450,8 +1477,19 @@ function apply(ctx) {
|
|||
} catch {
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
return null;
|
||||
}, [mode]);
|
||||
if (mode !== "inline") return null;
|
||||
return (0, import_react.createElement)("div", { className: "ssw-tab-body" }, (0, import_react.createElement)(SanshengWorkbench, {
|
||||
onClose: () => {
|
||||
const layout = get("layout");
|
||||
if (layout && isFn(layout.selectPanel)) {
|
||||
try {
|
||||
layout.selectPanel(null);
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
function registerNavEntry() {
|
||||
if (!ctx.slots || !isFn(ctx.slots.inject) || !isFn(ctx.slots.register)) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "dsh-sansheng-liubu",
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.3",
|
||||
"description": "三省六部:每个项目固定十席角色与独立会话的 DSH 插件(第一版)。",
|
||||
"keywords": [
|
||||
"dsh-plugin",
|
||||
|
|
|
|||
|
|
@ -195,16 +195,37 @@ export function apply(ctx) {
|
|||
// ---------- 右侧标签页(真实契约:register 类型 + 正文/标题 slot;不可用时回退浮动面板) ----------
|
||||
function ensureRightTab() {
|
||||
const tabs = get('sidebarRightTabs')
|
||||
return !!(tabs && isFn(tabs.get) && tabs.get(TAB_KIND))
|
||||
if (!tabs || !isFn(tabs.get)) return false
|
||||
try { return !!(tabs.get(TAB_KIND) || tabs.get(TAB_TYPE_ID)) } catch { return false }
|
||||
}
|
||||
// 桌面版右栏常是收起状态:只 openTab 不展开,用户会以为“点了没反应”。
|
||||
function revealRightTab() {
|
||||
const right = get('sidebarRight')
|
||||
if (!right) return
|
||||
try {
|
||||
const rows = isFn(right.openTabs?.getSnapshot) ? right.openTabs.getSnapshot() : []
|
||||
const row = Array.isArray(rows) ? rows.find(item => item && item.kind === TAB_KIND) : null
|
||||
if (row && isFn(right.focus)) right.focus(row.tabId)
|
||||
if (isFn(right.isExpanded) && !right.isExpanded() && isFn(right.toggleExpanded)) right.toggleExpanded()
|
||||
} catch (error) {
|
||||
console.warn('[sansheng] 展开右侧栏失败:', error && error.message ? error.message : error)
|
||||
}
|
||||
}
|
||||
function tryOpenRightTab() {
|
||||
const right = get('sidebarRight')
|
||||
if (!right || !isFn(right.openTab)) return false
|
||||
if (!ensureRightTab()) return false
|
||||
try { right.openTab(TAB_KIND); return true } catch (error) {
|
||||
try { right.openTab(TAB_KIND) } catch (error) {
|
||||
console.warn('[sansheng] 打开右侧标签失败,改用浮动面板:', error && error.message ? error.message : error)
|
||||
return false
|
||||
}
|
||||
revealRightTab()
|
||||
// 确认页签确实出现;宿主拒绝(例如当前没有会话面板)时返回 false,让调用方回退,避免“点了没反应”。
|
||||
try {
|
||||
const rows = isFn(right.openTabs?.getSnapshot) ? right.openTabs.getSnapshot() : null
|
||||
if (Array.isArray(rows) && rows.length > 0 && !rows.some(item => item && item.kind === TAB_KIND)) return false
|
||||
} catch { /* 读不到就按已打开处理 */ }
|
||||
return true
|
||||
}
|
||||
function SanshengTabBody() {
|
||||
return h('div', { className: 'ssw-tab-body' }, h(SanshengWorkbench, {}))
|
||||
|
|
@ -558,16 +579,27 @@ export function apply(ctx) {
|
|||
)
|
||||
}
|
||||
|
||||
// 兜底:若宿主仍按整行点击切换了主区,这里立刻打开右侧工作台并切回会话,不遮挡中央聊天。
|
||||
// 兜底:若宿主按整行点击切了主区,先把工作台打开到右侧并切回会话;
|
||||
// 右侧打不开时就在主区直接渲染工作台(而不是空白),保证点击一定有反应。
|
||||
function SanshengNavFallback() {
|
||||
const [mode, setMode] = useState('pending')
|
||||
useEffect(() => {
|
||||
openRightWorkbench()
|
||||
setMode(openRightWorkbench() ? 'docked' : 'inline')
|
||||
}, [])
|
||||
useEffect(() => {
|
||||
if (mode !== 'docked') return
|
||||
const layout = get('layout')
|
||||
if (layout && isFn(layout.selectPanel)) {
|
||||
try { layout.selectPanel(null) } catch { /* 忽略 */ }
|
||||
}
|
||||
}, [])
|
||||
return null
|
||||
}, [mode])
|
||||
if (mode !== 'inline') return null
|
||||
return h('div', { className: 'ssw-tab-body' }, h(SanshengWorkbench, {
|
||||
onClose: () => {
|
||||
const layout = get('layout')
|
||||
if (layout && isFn(layout.selectPanel)) { try { layout.selectPanel(null) } catch { /* 忽略 */ } }
|
||||
},
|
||||
}))
|
||||
}
|
||||
|
||||
function registerNavEntry() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue