Commit Graph
9 Commits
Author SHA1 Message Date
weichenandCursor 46769467bf chore(web): add Playwright UI-only acceptance skeleton
Add @playwright/test, headless config, and document-revision-runtime specs
gated by RUN_UI_ACCEPTANCE without mocks, routes, or API/DB fixtures.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 10:09:18 +00:00
WeiCHEN 222b0c2dd6 feat(doc-preview): 上传文档多格式在线预览 + IndexedDB 持久化恢复
## 新增功能
- 支持用户上传的 Word(.docx)、PDF、Excel(.xlsx/.csv)、PPT(.pptx)、
  图像(png/jpg/svg/webp等)、纯文本/代码文件的在线高保真预览
- 预览与受控工作流文档严格隔离:上传文档走 FilePreviewPanel,
  工作流/对话入库文档继续走 BlockRenderer,互不干扰

## 核心 Bug 修复
- 修复页面刷新后上传文件无法预览/下载的根本问题
  - 根因:File 对象无法 JSON 序列化,刷新后内存引用丢失
  - 方案:新增 fileStore.ts,使用 IndexedDB 持久化文件二进制内容
  - App 启动时自动 restoreFileRawToDeliverables() 从 IndexedDB 恢复 fileRaw
  - 上传时 saveFile() 同步写入 IndexedDB(fire-and-forget)

## 下载按钮修复
- 优先从内存 File 对象动态创建 blob URL,避免依赖已 revoke 的旧 URL
- 文件内容不可用时按钮禁用并显示 tooltip 说明

## 存储层改进
- saveDeliverables() 序列化前剔除 fileRaw(不可持久化)和 blob: URL
  避免 localStorage 保存损坏的空对象

## 新增文件
- web/src/data/fileStore.ts — IndexedDB 封装(saveFile/getFile/restore)
- web/src/components/doc/preview/FilePreviewPanel.tsx — 预览面板主组件
- web/src/components/doc/preview/renderers/DocxViewer.tsx — Word 预览
- web/src/components/doc/preview/renderers/PdfViewer.tsx  — PDF 预览
- web/src/components/doc/preview/renderers/ExcelViewer.tsx — Excel 预览
- web/src/components/doc/preview/renderers/PptViewer.tsx  — PPT 预览
- web/src/components/doc/preview/renderers/ImageViewer.tsx — 图像预览
- web/src/components/doc/preview/renderers/TextViewer.tsx  — 文本预览
- web/src/tests/file-preview.test.ts — 预览功能单元测试
2026-09-13 02:50:21 +00:00
WeiCHEN 1cfe3f9f02 feat(history): 完成 Phase P3 虚拟滚动、聊天记录导出与协同未读提醒
- 虚拟滚动:接入 @tanstack/react-virtual,封装 useVirtualMessages 动态测高与 overscan 预渲染,迁移 anchorNavigator 锚点定位与 SSR 兼容降级
- 聊天记录导出:基于既有 docx 与 xlsx 依赖实现 chatExporter 与 ChatExportModal,新增服务端 /api/v1/chat/export/messages 支持按条件导出
- 协同未读标记:新增 useUnreadMarks 30s 轮询与服务端 /api/v1/chat/unread 接口,日历格与工具栏支持橙色未读徽标提示
- 测试与验证:新增 chat_unread_and_export_api_test.go,前端全量 126 项单元/组件测试及生产打包 100% 通过
2026-09-13 02:50:20 +00:00
WeiCHENandCursor 80383269e9 feat(engine): 实现 DOCX 原生 OMML 数学公式、Mermaid 高清渲染与出版级公文排版
- 集成 mathml2omml 与 KaTeX,实现展示级公式 (<m:oMathPara>) 与行内公式 (<m:oMath>) 的微软原生矢量公式渲染
- 实现 svgToPngData 将 Mermaid 矢量图光栅化为 2.5x 视网膜清晰度的 PNG 图片嵌入 Word
- 重构公文抬头、4列受控签署栏、出版级三线表、keepNext 防孤行与带分割线的受控页眉页脚

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 77d854e343 feat(web): build interactive card component with lifecycle and idempotency
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor fefb53ef30 feat(engine): 实现 DOCX 与 XLSX 客户端原生渲染导出引擎
- 引入 docx 与 xlsx 依赖,纯前端无损编译 Block AST 交付物
- buildDocxModel: 自动生成两行四列受控签署栏、多级编号标题、Markdown富文本、医疗标准三线表、Cambria Math公式与动态页眉页脚
- buildXlsxWorkbook: 自动提取文档概览与全部数据表格,生成带自适应列宽的 Excel 工作簿并支持直接下载

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 9c4a839932 feat(ui): 修复模态背景穿透、公式/富文本Markdown解析并集成右键快捷菜单
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 6885c48d48 chore(web): update package-lock.json with tsx
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00
WeiCHENandCursor 36afce14e6 feat(web): initialize react 19 vite typescript scaffold and token design system
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:19 +00:00