fix(ui): 删底栏资源库按钮 + 停靠栏按插件过滤 + 修右侧栏串面板(v3.25.82)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 25s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 25s
This commit is contained in:
1 parent
34269f9770
commit
73a7126e30
19 files changed
+126
-41
No files matched your search
@@ -134,10 +134,7 @@ function ToolbarBottom(props) {
|
||||
el('button', { className: 'iwb-btn', 'data-tip': '配置', onClick: () => onAdd('gen') }, I('gen')),
|
||||
el('button', { className: 'iwb-btn', 'data-tip': '输出', onClick: () => onAdd('out') }, I('presentation')),
|
||||
),
|
||||
el('span', { className: 'iwb-toolbar-sep' }, null),
|
||||
el('span', { className: 'iwb-tgroup' },
|
||||
el('button', { className: 'iwb-btn', 'data-tip': '资源库', onClick: onOpenPrompts }, I('archive')),
|
||||
),
|
||||
// v3.25.82:底栏「资源库」按钮已删(右侧栏/提示词库面板已覆盖该入口,用户裁定)
|
||||
// 最右侧独立一格:缩放(−/+)+ 适应视图(显示全部节点)。适应与快捷键 Shift+F 等价。
|
||||
el('span', { className: 'iwb-toolbar-sep' }, null),
|
||||
el('span', { className: 'iwb-tgroup' },
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/* ui-dock-panels.js —— 停靠栏面板清单(v3.25.82)
|
||||
*
|
||||
* 职责:给出「当前可用」的左右栏面板表。
|
||||
* 规则(用户裁定):插件被关闭/未安装时,该面板不出现在左右栏;
|
||||
* 若某侧一个可用面板都没有,ui-dock 会整侧不渲染。
|
||||
* 兜底:插件宿主尚未就绪(list 为空,jsdom/首次启动)时不过滤,避免把面板全藏掉。
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
|
||||
const ALL = {
|
||||
groups: { title: '节点组', icon: 'group', pluginId: 'grouplib', hint: '节点组插件未安装 · 设置 → 插件 → 市场安装' },
|
||||
browser: { title: '浏览器', icon: 'globe', pluginId: 'browser' },
|
||||
styles: { title: '风格库', icon: 'palette', pluginId: 'style-source' },
|
||||
prompts: { title: '提示词库', icon: 'book', pluginId: 'promptlib', hint: '提示词库插件未安装 · 设置 → 插件 → 市场安装' },
|
||||
gallery: { title: '图库', icon: 'ref', pluginId: 'gallery', hint: '图库插件未安装 · 设置 → 插件 → 市场安装' },
|
||||
}
|
||||
|
||||
function build (PluginHost) {
|
||||
let list = []
|
||||
try { list = (PluginHost && typeof PluginHost.list === 'function') ? (PluginHost.list() || []) : [] } catch (e) { list = [] }
|
||||
const ready = list.length > 0
|
||||
const out = {}
|
||||
for (const k of Object.keys(ALL)) {
|
||||
const p = ALL[k]
|
||||
if (ready && p.pluginId) {
|
||||
const hit = list.find((x) => x && x.id === p.pluginId)
|
||||
if (!hit || !hit.enabled) continue
|
||||
}
|
||||
out[k] = p
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
global.IWBUIDockPanels = { build, ALL }
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
+17
-1
@@ -174,7 +174,20 @@
|
||||
if (side === 'right') { const next = !dock.right.open; setSide('right', { open: next }); if (typeof props.onRightOpen === 'function') props.onRightOpen(next) }
|
||||
}
|
||||
global.addEventListener('iwb:dock-toggle', onToggle)
|
||||
return function () { global.removeEventListener('iwb:dock-toggle', onToggle) }
|
||||
// v3.25.82:显式激活某侧面板(右侧栏不再由宿主强行指定 active,避免「图库旁边冒出提示词库」)
|
||||
const onActivate = function (e) {
|
||||
const det = e && e.detail
|
||||
if (!det || (det.side !== 'left' && det.side !== 'right') || !det.id || !panels[det.id]) return
|
||||
setDock(function (d) {
|
||||
const side = d[det.side]
|
||||
if (side.active === det.id) return d
|
||||
const next = Object.assign({}, d)
|
||||
next[det.side] = Object.assign({}, side, { active: det.id })
|
||||
return next
|
||||
})
|
||||
}
|
||||
global.addEventListener('iwb:dock-activate', onActivate)
|
||||
return function () { global.removeEventListener('iwb:dock-toggle', onToggle); global.removeEventListener('iwb:dock-activate', onActivate) }
|
||||
}, [dock.left.open, dock.right.open, props.onRightOpen])
|
||||
|
||||
// ---- 拖宽(内缘手柄) ----
|
||||
@@ -310,6 +323,9 @@
|
||||
|
||||
const renderDock = function (side) {
|
||||
const s = dock[side]
|
||||
// v3.25.82:插件被关掉后该侧没有可用面板 → 整侧不渲染(连折叠窄条都不画)
|
||||
const usable = (s.list || []).filter(function (id) { return !!panels[id] })
|
||||
if (!usable.length) return null
|
||||
if (!s.open) return null
|
||||
return el('div', {
|
||||
key: side,
|
||||
|
||||
Reference in new issue
Block a user