mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
cleaned up redundant variables, fixed eslint fix command, split snippetList into component
This commit is contained in:
@@ -104,8 +104,8 @@ function handleAttachmentDrop (codeEditor, storageKey, noteKey, dropEvent) {
|
||||
const fileType = file['type']
|
||||
|
||||
copyAttachment(filePath, storageKey, noteKey).then((fileName) => {
|
||||
let showPreview = fileType.startsWith('image')
|
||||
let imageMd = generateAttachmentMarkdown(originalFileName, path.join(STORAGE_FOLDER_PLACEHOLDER, noteKey, fileName), showPreview)
|
||||
const showPreview = fileType.startsWith('image')
|
||||
const imageMd = generateAttachmentMarkdown(originalFileName, path.join(STORAGE_FOLDER_PLACEHOLDER, noteKey, fileName), showPreview)
|
||||
codeEditor.insertAttachmentMd(imageMd)
|
||||
})
|
||||
}
|
||||
@@ -139,7 +139,7 @@ function handlePastImageEvent (codeEditor, storageKey, noteKey, dataTransferItem
|
||||
const destinationDir = path.join(targetStorage.path, DESTINATION_FOLDER, noteKey)
|
||||
createAttachmentDestinationFolder(targetStorage.path, noteKey)
|
||||
|
||||
let imageName = `${uniqueSlug()}.png`
|
||||
const imageName = `${uniqueSlug()}.png`
|
||||
const imagePath = path.join(destinationDir, imageName)
|
||||
|
||||
reader.onloadend = function () {
|
||||
@@ -147,7 +147,7 @@ function handlePastImageEvent (codeEditor, storageKey, noteKey, dataTransferItem
|
||||
base64data += base64data.replace('+', ' ')
|
||||
const binaryData = new Buffer(base64data, 'base64').toString('binary')
|
||||
fs.writeFile(imagePath, binaryData, 'binary')
|
||||
let imageMd = generateAttachmentMarkdown(imageName, imagePath, true)
|
||||
const imageMd = generateAttachmentMarkdown(imageName, imagePath, true)
|
||||
codeEditor.insertAttachmentMd(imageMd)
|
||||
}
|
||||
reader.readAsDataURL(blob)
|
||||
|
||||
Reference in New Issue
Block a user