9ff51ac2f3
Adds a DocBlock component that renders embedded documents, new export buttons for DOCX and PDF, and updates the file‑upload picker to accept *.txt, *.docx, *.pptx, and *.pdf. Introduces a DOCX→PDF conversion bridge in the backend and new /tts and /asr endpoints that expose TTS and speech‑recognition functionality. The README is rewritten to describe the new features and clean up legacy documentation. All changes are backward‑compatible and do not introduce breaking API changes.
1.3 KiB
1.3 KiB
导出按钮缺失修复计划
问题分析
当前 action-buttons 区域只有以下按钮可见:
- 上传文件
- 导入 Markdown
- 导出 Markdown
- 上传图片
- AI 切换按钮
缺失功能:DOCX 和 PDF 导出按钮
调查结果
- ✅ 翻译文件中已存在
exportDocx和exportPdf键名(src/utils/i18n.js) - ❌ 模板中完全缺失这两个按钮的 HTML 代码
- ❓ 导出功能后端已实现,前端只需要添加调用接口的按钮
- ✅ 相关 CSS 样式已存在,按钮外观无需额外调整
实施计划
1. 添加 UI 按钮
在 src/components/MilkdownEditor.vue:79 之后添加两个新按钮:
- DOCX 导出按钮
- PDF 导出按钮
按钮位置:
导出 Markdown → 导出 DOCX → 导出 PDF → 上传图片
2. 实现前端导出功能
使用已安装的依赖库:
docx库:用于 DOCX 导出html2pdf.js库:用于 PDF 导出
需要添加的函数:
const exportDocx = async () => {
// 使用 docx 库实现导出
}
const exportPdf = async () => {
// 使用 html2pdf.js 实现导出
}
3. 按钮图标
- DOCX:使用文档图标
- PDF:使用 PDF 专用图标
4. 状态管理
添加加载状态和错误处理,与现有按钮保持一致风格