mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
fix gif
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user