实现跨边界拖拽功能:支持从浏览器拖拽文件到系统
主要改进: - 使用 File System Access API 实现真正的跨应用边界文件传输 - 支持拖拽到窗口外自动触发系统保存对话框 - 智能路径记忆功能,记住用户上次选择的保存位置 - 多文件自动打包为 ZIP 格式 - 现代浏览器优先使用新 API,旧浏览器降级到传统下载 - 完整的视觉反馈和进度显示 技术实现: - 新增 useDragToSystemDesktop hook 处理系统级拖拽 - 扩展 Electron 主进程支持拖拽临时文件管理 - 集成 JSZip 库支持多文件打包 - 使用 IndexedDB 存储用户偏好的保存路径 - 优化文件管理器拖拽事件处理链 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,20 @@ contextBridge.exposeInMainWorld("electronAPI", {
|
||||
isDev: process.env.NODE_ENV === "development",
|
||||
|
||||
invoke: (channel, ...args) => ipcRenderer.invoke(channel, ...args),
|
||||
|
||||
// ================== 拖拽API ==================
|
||||
|
||||
// 创建临时文件用于拖拽
|
||||
createTempFile: (fileData) => ipcRenderer.invoke("create-temp-file", fileData),
|
||||
|
||||
// 创建临时文件夹用于拖拽
|
||||
createTempFolder: (folderData) => ipcRenderer.invoke("create-temp-folder", folderData),
|
||||
|
||||
// 开始拖拽到桌面
|
||||
startDragToDesktop: (dragData) => ipcRenderer.invoke("start-drag-to-desktop", dragData),
|
||||
|
||||
// 清理临时文件
|
||||
cleanupTempFile: (tempId) => ipcRenderer.invoke("cleanup-temp-file", tempId),
|
||||
});
|
||||
|
||||
window.IS_ELECTRON = true;
|
||||
|
||||
Reference in New Issue
Block a user