1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00
This commit is contained in:
Baptiste Augrain
2019-02-04 13:54:45 +01:00
parent cd301d514c
commit de76f55fe2

View File

@@ -278,15 +278,23 @@ function handleAttachmentDrop (codeEditor, storageKey, noteKey, dropEvent) {
let promise let promise
if (dropEvent.dataTransfer.files.length > 0) { if (dropEvent.dataTransfer.files.length > 0) {
promise = Promise.all(Array.from(dropEvent.dataTransfer.files).map(file => { promise = Promise.all(Array.from(dropEvent.dataTransfer.files).map(file => {
if (file['type'].startsWith('image') && !file['type'].endsWith('gif')) { if (file.type.startsWith('image')) {
return fixRotate(file) if (file.type.endsWith('gif')) {
.then(data => copyAttachment({type: 'base64', data: data, sourceFilePath: file.path}, storageKey, noteKey) return copyAttachment(file.path, storageKey, noteKey).then(fileName => ({
.then(fileName => ({ fileName,
fileName, title: path.basename(file.path),
title: path.basename(file.path), isImage: true
isImage: true }))
})) } else {
) return fixRotate(file)
.then(data => copyAttachment({type: 'base64', data: data, sourceFilePath: file.path}, storageKey, noteKey)
.then(fileName => ({
fileName,
title: path.basename(file.path),
isImage: true
}))
)
}
} else { } else {
return copyAttachment(file.path, storageKey, noteKey).then(fileName => ({ return copyAttachment(file.path, storageKey, noteKey).then(fileName => ({
fileName, fileName,