Files
2026-11-26 07:31:59 +08:00

22 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# IWB 插件避坑总索引(2026-11-26)
> 每个插件目录下的 `PITFALLS.md` 是**该插件专属**的硬约束;本文件只放跨插件共性。
> 这些文件只留在源仓,不会被打进插件 zip(`sync-plugins-from-repo` / `gen-market` 只取 manifest/main/style/assets)。
## 跨插件共性
1. **插件样式在宿主之后加载**:同优先级会覆盖宿主;需要宿主兜底的规则(如选中态)必须用更高优先级,不能假设插件 CSS 会赢。
2. **用户动作失败必须可见**:`settings.set` / 写盘失败不能 `catch {}` 静默;至少 toast/tooltip/可见状态。
3. **版本三处一致**:`package.json`、入口 `version`、市场索引;否则客户端按版本比较不会更新。
4. **旧客户端 fallback**:新增宿主能力(如 `saveNodeImage`、原生菜单)必须有旧路径;不能假设所有用户已升级。
5. **原生 webview 永远在 DOM 之上**:任何浮层要么用原生菜单,要么 park 网页,要么放在不重叠区域;`z-index` 无效。
6. **SPA 地址**:不要只依赖页面加载事件;宿主轮询 `canvas_webview_state`,插件只读 `st.pageUrl`。
7. **发版前跑本插件 harness/测试**,再 `sync-plugins-from-repo`,最后 `gen-market` + 上传;插件文档不打包。
## 插件文档
- [browser](browser/PITFALLS.md):原生菜单/SPA 地址/收藏目标组
- [image-annotate](image-annotate/PITFALLS.md):覆盖保存事务/桌面 cache 引用
- [gallery](gallery/PITFALLS.md):选中态/勾选点/补存
- [album](album/PITFALLS.md):宫格 hover 只缩放/不位移