chore(plugin): 清掉便利贴的面板专用样式;补 side 字段文档
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 39s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 39s
便利贴面板移除后,ensureStyle 里 9 条只服务面板的 CSS(iwb-sticky-panel* / iwb-sticky-add* / iwb-sticky-list / iwb-sticky-row* / iwb-sticky-go*)成为死代码,一并删除; 节点本身的样式(iwb-sticky-node*)保持不变。index.json 的 SRI 同步更新。 文档:docs/standards/plugin-development.md 的面板章节补 icon / side 字段, 并写明「side 只决定首次回填、用户摆放优先」「纯节点插件不必注册面板」。 验证:npm run verify:ci 全绿(含 e2e 冒烟 31 条 / 45s)。
This commit is contained in:
1 parent
c313a11f3e
commit
e02c3b66e9
3 files changed
+7
-11
No files matched your search
@@ -63,10 +63,15 @@ package.json:
|
||||
ctx.ui.registerPanel({
|
||||
id: 'my-panel',
|
||||
title: '我的插件',
|
||||
icon: 'star', // 可选:停靠栏图标(缺省 puzzle)
|
||||
side: 'left', // 可选:默认落哪一侧(left | right,缺省 right)
|
||||
mount (host) { /* 渲染到 host */ },
|
||||
unmount (host) { /* 清理定时器/监听 */ }
|
||||
})
|
||||
|
||||
- 面板进左右停靠栏,面板 key 为 plugin:<插件id>:<面板id>。
|
||||
- side 只决定**首次**回填到哪一侧;用户拖到另一侧后以用户摆放为准,用户移除过的不会自动加回。
|
||||
- 只有节点能力的插件不必注册面板(例:便利贴只是画布节点)。
|
||||
- mount 只调用一次,内部自己管理重渲染。
|
||||
- 面板宽度可变:使用栅格/瀑布流,不要写死 px 宽度。
|
||||
- 面板内所有 DOM 事件在 unmount 时移除。
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@
|
||||
"id": "sticky",
|
||||
"file": "plugin-sticky.f5f77ac81467.js",
|
||||
"version": "1.0.9",
|
||||
"integrity": "sha256-LhTIND2kB+MhL6Z5GQUh30X9m+rkVqSZz40MzysGSvo="
|
||||
"integrity": "sha256-87g19guK6S/+xKNXRf3UKw/ODlZChhtZcUdKtAZ8g9o="
|
||||
},
|
||||
{
|
||||
"id": "style-source",
|
||||
|
||||
@@ -16,22 +16,13 @@
|
||||
|
||||
if (!global.IWBPluginHost) return
|
||||
|
||||
// 必须在脚本执行时就注入:面板可能瞬间挂载、节点可能从存档直接出现(面板从不 mount)。
|
||||
// 必须在脚本执行时就注入:节点可能从存档直接出现(先渲染、后挂载)。
|
||||
function ensureStyle() {
|
||||
if (typeof document === 'undefined' || !document.createElement) return
|
||||
if (document.getElementById('iwb-sticky-style')) return
|
||||
var css = '' +
|
||||
'#iwb-sticky-style{}' +
|
||||
'[hidden]{display:none!important}' +
|
||||
'.iwb-sticky-panel{display:flex;flex-direction:column;gap:12px;font-size:13px;color:var(--iwb-text,#1c2333)}' +
|
||||
'.iwb-sticky-panel-tip{font-size:12px;line-height:1.6;color:var(--iwb-text2,#4d5668);opacity:.9}' +
|
||||
'.iwb-sticky-add{cursor:pointer;border:1px solid var(--iwb-brand,#6b7280);border-radius:8px;background:var(--iwb-layer2,#fff);color:var(--iwb-text,#1c2333);font-size:13px;padding:10px 14px;font-family:inherit}' +
|
||||
'.iwb-sticky-add:hover{background:var(--iwb-hover,#f0f1f4)}' +
|
||||
'.iwb-sticky-list{display:flex;flex-direction:column;gap:8px;margin-top:4px}' +
|
||||
'.iwb-sticky-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 10px;border:1px solid var(--iwb-border,#d5d9e0);border-radius:8px;background:var(--iwb-layer,#f5f6f8)}' +
|
||||
'.iwb-sticky-row-txt{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}' +
|
||||
'.iwb-sticky-go{cursor:pointer;border:1px solid var(--iwb-border,#d5d9e0);border-radius:6px;background:var(--iwb-layer2,#fff);color:var(--iwb-text,#1c2333);font-size:12px;padding:4px 10px;white-space:nowrap;font-family:inherit}' +
|
||||
'.iwb-sticky-go:hover{border-color:var(--iwb-brand,#6b7280)}' +
|
||||
// ---- 节点体 ----
|
||||
// 宿主容器 .iwb-plugin-node-body 是 flex 列且 padding:0;这里必须 flex:1 撑满,
|
||||
// 不能只写 height:100%(WKWebView 下百分比对 flex 项算不准,拖大后下半露出宿主底色)。
|
||||
|
||||
Reference in new issue
Block a user