Files
zWhiteBoard/README.md
zikai d7d7450296 feat: 共享记事本前端 zWhiteBoard
textarea + WebSocket 实时同步、心跳、断线重连的便携式 Vue 组件。
复用 zTools2 的 /api/wb/* 与 /api/ws/wb/* 接口,与 zPDF_package 集成范式一致。
可独立运行或经 mainPage 构建期组件 import 集成(:locale + :boardId props)。
2026-07-28 10:32:41 +08:00

27 lines
1.0 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.

# zWhiteBoard
共享记事本前端 -- textarea + WebSocket 实时同步、心跳、断线重连。复用 zTools2 后端 API。
## 集成方式
便携式组件,两种运行模式:
- **独立运行**`npm run dev` / `npm run build`,自带 i18n 与全局样式。
- **嵌入 mainPage**:作为 git submodule 挂在 zMainPage `third_party/zWhiteBoard`,经构建期组件 import 集成(非 iframe。mainPage 侧包装器 `Whiteboard.vue``PageShell` 并透传 `:locale` / `:boardId` props。
## 后端接口zTools2 提供,不改动)
- `GET /api/wb/{id}` -- 预取白板内容(不存在则服务端新建)
- `WS /api/ws/wb/{id}` -- 实时同步hello / edit / ping / clearC->Sinit / pong / update / cleared / errorS->C
全量文本同步(非 OT/CRDTlast-writer-wins400ms debounce3s 心跳2s 固定重连。
## 开发
```bash
npm install
npm test # 单元测试
npm run dev # 开发服务器(代理 /api -> 本地 zTools2:6867含 ws:true
npm run build # 产物在 dist/
```