Files
zWhiteBoard/docs/integration.md
root b9ea2c322a refactor: 清理死代码/提前失败/日志/高内聚低耦合
死代码移除:
- useWhiteboard.js: 移除未使用的 suppressInput 变量及 6 处赋值;
  移除 isInputSuppressed / _getSuppressInput / _setEditor 导出;
  scheduleSend 从公开 API 降为内部函数; setStatus 移除未用 isErr 形参
- useLocale.js: 移除未用的 isZh/pick/locale 返回值及 computed 导入
- App.vue: 移除未用的 ref 导入
- i18n locales: 移除 5 个死 key (switch/copied/copiedLink/copyFailed/emptyText)

提前失败/日志:
- 7 处 silent catch (send/connect/onerror/onMessage JSON.parse/
  applyRemoteUpdate setSelectionRange/connectBoard 预取/teardownSocket)
  全部加 console.error/warn, 统一 [zWB] 前缀
- App.vue onCopyText/onCopyLink 失败 console.warn

文档:
- 新增 docs/error-handling.md, docs/integration.md
- README.md 重写为简洁版 (简介/结构/外部依赖/Ubuntu 安装使用/docs 链接)
2026-07-28 11:22:01 +08:00

21 lines
1.1 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.

# 嵌入 mainPage
zWhiteBoard 作为 [mainPage](https://git.zikai.wang/zikai/zMainPage) 的 git submodule`third_party/zWhiteBoard`),经构建期组件 import 集成(非 iframe与 timeTableFix / zPDF_package 同范式)。
## 集成方式
- mainPage 侧 `src/modules/whiteboard/Whiteboard.vue``PageShell` 并透传 `:locale` / `:boardId` props。
- 构建期直接 `import` 本项目 `src/App.vue`,共享 mainPage 的构建与 KeepAlive 缓存。
- 组件内 `useWhiteboard.js` 同源 fetch `/api/wb/*` 与 WS `/api/ws/wb/*`,反代第一方自动携带 cookie无需 CORS。
## 便携式设计(无 host 依赖)
组件自身保持「无 host 依赖」:
- 不持 `defineOptions({ name })`(避免与宿主组件名冲突)。
- 不引 mainPage 的 i18n仅靠 `:locale` prop 驱动自有 i18n 实例。
- `useLocale` 直接读本子项目模块级 `i18n.global`,而非 `useI18n()`(后者嵌入时会解析到宿主实例,文案回退成 key
- `App.vue` 仅经 `:boardId` prop 决定连哪个白板,不耦合宿主路由。
详见 mainPage 的 `docs/submodule-zWhiteBoard.md`