(attachment: FileAttachment)
| 219 | |
| 220 | // 读取附件为 data URL(用于预览) |
| 221 | export async function getAttachmentDataUrl(attachment: FileAttachment): Promise<string> { |
| 222 | const result = await window.api.attachment.read(attachment.localPath) |
| 223 | if (result.success && result.content) { |
| 224 | return `data:${attachment.type};base64,${result.content}` |
| 225 | } |
| 226 | throw new Error(result.error || 'Failed to read attachment') |
| 227 | } |
| 228 | |
| 229 | // 独立的文件选择并保存函数(用于消息编辑等场景) |
| 230 | export async function selectAndSaveAttachments(): Promise<FileAttachment[]> { |
no outgoing calls
no test coverage detected