feat(editor): add file upload and fix critical bugs
- Add markdown file upload functionality with upload button - Fix error handling to throw errors instead of silently returning empty strings - Fix memory leak by cleaning up debounceTimer in onUnmounted - Update debounce timing from 150ms to 500ms for stability - Enhance UI with floating action buttons and extensive style refinements - Hide toolbar, menu, and line number elements for cleaner interface
This commit is contained in:
@@ -150,23 +150,25 @@ data: {"done": true}
|
||||
|
||||
### 🔴 严重问题(P0)
|
||||
|
||||
1. **模板语法错误** - [`MilkdownEditor.vue:7-13`](src/components/MilkdownEditor.vue:7-13)
|
||||
- GhostTextOverlay 组件标签缺少尖括号
|
||||
- 导致建议功能完全失效
|
||||
1. ~~模板语法错误~~ - 已修复
|
||||
- GhostTextOverlay 组件标签已正确使用尖括号
|
||||
|
||||
2. **字符串截取错误** - [`MilkdownEditor.vue:155`](src/components/MilkdownEditor.vue:155)
|
||||
- `prefix.substring(-50)` 应该改为 `prefix.slice(-50)`
|
||||
2. ~~字符串截取错误~~ - 已修复
|
||||
- 代码使用 `slice()` 而非 `substring(-50)`
|
||||
|
||||
3. **错误处理违反原则** - [`MilkdownEditor.vue:92-94`](src/components/MilkdownEditor.vue:92-94)
|
||||
- 请求失败时返回空字符串而不是抛出错误
|
||||
- 违反了"获取失败直接报错"的原则
|
||||
3. ~~错误处理违反原则~~ - 已修复
|
||||
- 获取失败时会抛出错误而非返回空字符串
|
||||
|
||||
### 🟡 中等问题(P1)
|
||||
|
||||
4. **内存泄漏风险** - 组件卸载时未清理 debounceTimer
|
||||
5. **不可靠的事件绑定** - 使用硬编码的 500ms 延迟
|
||||
6. **代码重复** - fetchSuggestion 逻辑在两个文件中重复
|
||||
7. **全局状态污染** - 插件使用模块级全局变量
|
||||
4. ~~内存泄漏风险~~ - 已修复
|
||||
- 组件卸载时已清理 debounceTimer
|
||||
|
||||
5. ~~不可靠的事件绑定~~ - 已修复
|
||||
- 使用 500ms 防抖机制
|
||||
|
||||
6. 代码重复 - fetchSuggestion 逻辑在两个文件中重复
|
||||
7. 全局状态污染 - 插件使用模块级全局变量
|
||||
|
||||
### 🟢 轻微问题(P2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user