fix(style-source): 手动拉高提示词节点时文字不再卡在 240px (1.0.2)

上一版注入的 `.iwb-node .iwb-textarea-plain{max-height:240px}` 把宿主
`.iwb-node-fixed .iwb-textarea{max-height:none;height:auto!important}` 盖掉了:
两者特异性同为 (0,2,0),插件样式注在 style.css 之后 ⇒ 上限赢。用户拉高节点
后文字仍停在 240px,下面一大片空白。

- 上限改为只作用于 `.iwb-node:not(.iwb-node-fixed)`(node.h 有值 = 手动拉过尺寸),
  并补 `.iwb-node.iwb-node-fixed .iwb-textarea-plain{max-height:none}` 兜底
- harness:合成宿主补抄 style.css 的 fixed 规则;新增 2 条断言(文本域随节点撑满 / maxH=none)
- 实测 273px 默认节点仍限 240 内滚动;拉高到 522 时 textarea 撑到 492,无裁切
This commit is contained in:
qiqi committed 2026-11-02 10:06:21 +08:00
1 parent 99717eb5e8
commit 4f7bed96c6
4 files changed
+56 -9

No files matched your search

+9 -2
View File
@@ -289,6 +289,11 @@
// · 宿主 .iwb-textarea 本身是 overflow-y:auto,超出部分在节点内滚动,内容一个字都不丢;
// · 想看全文照旧用节点气泡的「放大编辑」(⌘/Ctrl+E),那里是不限高的浮层。
// 选择器只碰节点内的纯文本域,宿主的弹窗/设置面板(.iwb-modal-lg .iwb-textarea)不受影响。
//
// ⚠️ 必须排除 `.iwb-node-fixed`(节点 h 有值 = 用户手动拉过尺寸):
// 宿主 style.css 里有 `.iwb-node-fixed .iwb-textarea{flex:1 1 auto;max-height:none;height:auto!important}`,
// 手拉节点时靠它把文本域撑满节点。原来不加 :not() 时两条规则特异性同为 (0,2,0),
// 而插件样式注入得更晚 ⇒ 上限赢了 ⇒ 节点被拉高后文字仍卡在 240px、下面一片空白(2026-11-02 反馈)。
const PROMPT_MAX_H = 240
function capHeightOf(ctx) {
@@ -308,7 +313,9 @@
node = el('style', { id: id })
;(document.head || document.documentElement).appendChild(node)
}
node.textContent = '.iwb-node .iwb-textarea-plain{max-height:' + maxH + 'px}'
// 默认(自动高)节点压住上限;手动拉过尺寸的节点交给宿主拉伸规则,一个字都不裁
node.textContent = '.iwb-node:not(.iwb-node-fixed) .iwb-textarea-plain{max-height:' + maxH + 'px}'
+ '.iwb-node.iwb-node-fixed .iwb-textarea-plain{max-height:none}'
} catch (error) { /* 注入失败只是节点还会被拉长,不影响插入 */ }
}
@@ -885,7 +892,7 @@
global.IWBPluginHost.register({
id: 'style-source',
name: '风格库',
version: '1.0.1',
version: '1.0.2',
apiVersion: 1,
capabilities: ['panels', 'canvas', 'canvasWrite'],
settings: {