Skip to content

fix(clipboard): 修复浏览器右键复制图片时被识别为富文本的问题#1258

Open
Moeblack wants to merge 4 commits intoEcoPasteHub:masterfrom
Moeblack:fix/clipboard-image-html
Open

fix(clipboard): 修复浏览器右键复制图片时被识别为富文本的问题#1258
Moeblack wants to merge 4 commits intoEcoPasteHub:masterfrom
Moeblack:fix/clipboard-image-html

Conversation

@Moeblack
Copy link
Copy Markdown

改动

  • useClipboard 钩子中增加了对剪贴板内容的智能判断逻辑。
  • 当剪贴板同时包含 HTML 和 Image 时,解析 HTML 内容:
    • 如果 HTML 仅包含 <img> 标签且无可见文本,或者
    • 如果附带的文本仅为 URL,
  • 则判定用户意图为“复制图片”,强制将其作为图片类型保存,而非富文本。

原因

  • 修复了在浏览器(如 Chrome/Edge)中右键“复制图片”时,EcoPaste 错误地将其识别为 HTML 代码而不是图片文件的问题。
  • 解决了用户无法将此类记录粘贴到即时通讯软件或图像编辑软件中的痛点。

关联

Moeblack and others added 4 commits February 7, 2026 03:16
- Add FTS5 trigram full-text index for search (7~21x faster than LIKE)
- Enable WAL journal mode for concurrent read/write
- Add B-Tree indexes on createTime, group+createTime, favorite+createTime
- Truncate value field in list queries (substr 500 chars) to avoid multi-MB text/HTML slowing down rendering
- Add getHistoryFullValue() for on-demand full content retrieval
- Add 200ms search input debounce to reduce query frequency
- Fix stale search results overwriting newer results (fetchId mechanism)
- Fix Windows false blur events causing hideWindow/autoClear regression (isFocused double-check)
- Add image path resolution cache to avoid repeated disk I/O
- Support VITE_ECOPASTE_TESTDATA_DIR for dev testing with isolated data

Co-authored-by: Cursor <cursoragent@cursor.com>
- 启用 WAL journal 模式,实现读写并发(搜索时不阻塞剪贴板写入)
- 添加 B-Tree 索引:createTime、group+createTime、favorite+createTime
- 配合分页查询(ORDER BY createTime DESC LIMIT),索引可显著减少扫描行数

相关 issues:EcoPasteHub#467
fix: 当剪贴板同时包含 HTML 和 Image 时,如果 HTML 仅包含 <img> 标签或文本仅为 URL,优先识别为图片。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant