feat(style-source): 变量全部平铺,去掉「展开其余 N 个变量」按钮 (1.0.4)
用户反馈:折叠按钮的「收起」状态容易让人以为变量就这几个,且要多点一次。 - 删掉 VAR_SHOW=6 的折叠逻辑与 .iwb-ss-vartoggle / .iwb-ss-varmore 相关代码样式 - 有多少占位符就平铺多少输入框,详情页本身可滚动(Vigo 那批最多 24 个也能撑住) - harness:删「先给 6 个 / 折叠默认收起 / 点展开后出现」3 条,换成 「8 个输入框全可见且无折叠按钮」;顺手修正 2 条随上游数据整改失效的样本断言 (mondrian 8 个已全部有声明 → 改断言中英混写声明都能对上; 婚礼那 3 个也不再是零声明 → 改断言标签可读)
This commit is contained in:
1 parent
005c0307a6
commit
3f3bd5690b
4 files changed
+19
-51
No files matched your search
@@ -246,7 +246,6 @@
|
||||
}
|
||||
/* 提示词里有 {X}、但数据里没声明变量 ⇒ 标签只能用占位符名,压暗一点做区分 */
|
||||
.iwb-ss-varlabel.is-implicit { opacity: .62; font-style: italic; }
|
||||
.iwb-ss-vartoggle { width: 100%; height: 24px; margin: 2px 0 4px; font-size: var(--fs-sm, 11px); }
|
||||
.iwb-ss-varinput {
|
||||
flex: 1 1 auto; min-width: 0; height: 24px; padding: 0 7px;
|
||||
border: 1px solid var(--iwb-border, #d5d9e0); border-radius: var(--rd-sm, 6px);
|
||||
@@ -396,8 +395,7 @@
|
||||
// { '`SUBJECT`': 'main subject' } ← 老导入数据:值是人话,只能拿 key 兜底(key 上还残留反引号)
|
||||
const PH_RE = /\{([^{}\n]{1,40})\}/g
|
||||
|
||||
// 变量区默认显示几个,其余折叠(Vigo 那批风格单条提示词最多 24 个占位符)
|
||||
const VAR_SHOW = 6
|
||||
// 变量全部平铺,不做折叠:折叠按钮的"收起"状态容易让人以为变量就这些
|
||||
|
||||
// 排掉 JSON 碎片、句子、空括号:占位符名只能是一个短标识符
|
||||
function isPlaceholderName(name) {
|
||||
@@ -816,23 +814,8 @@
|
||||
onInput: (event) => { values[item.name] = event.target.value; refreshPreview() },
|
||||
}),
|
||||
])
|
||||
// 一次铺满 24 个输入框会把详情页顶爆(Vigo 那批就是),先给 6 个,其余折起来
|
||||
for (const item of keys.slice(0, VAR_SHOW)) varBox.appendChild(rowOf(item))
|
||||
const tail = keys.slice(VAR_SHOW)
|
||||
if (tail.length) {
|
||||
const more = el('div', { class: 'iwb-ss-varmore', style: 'display:none' })
|
||||
for (const item of tail) more.appendChild(rowOf(item))
|
||||
const toggle = el('button', {
|
||||
class: 'iwb-ss-btn iwb-ss-vartoggle', text: '展开其余 ' + tail.length + ' 个变量',
|
||||
onClick: () => {
|
||||
const opening = more.style.display === 'none'
|
||||
more.style.display = opening ? '' : 'none'
|
||||
toggle.textContent = opening ? '收起' : '展开其余 ' + tail.length + ' 个变量'
|
||||
},
|
||||
})
|
||||
varBox.appendChild(toggle)
|
||||
varBox.appendChild(more)
|
||||
}
|
||||
// 全部平铺(Vigo 那批最多 24 个,详情页本身可滚动,不再折叠)
|
||||
for (const item of keys) varBox.appendChild(rowOf(item))
|
||||
bodyEl.appendChild(varBox)
|
||||
}
|
||||
|
||||
@@ -968,7 +951,7 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'style-source',
|
||||
name: '风格库',
|
||||
version: '1.0.3',
|
||||
version: '1.0.4',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'canvas', 'canvasWrite'],
|
||||
settings: {
|
||||
|
||||
Reference in new issue
Block a user