mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-15 02:36:36 +00:00
Error message when the image path is wrong
This commit is contained in:
committed by
Junyoung Choi
parent
65926fea73
commit
ea6e56842f
@@ -923,6 +923,8 @@ class NoteList extends React.Component {
|
|||||||
.then((newcontent) => {
|
.then((newcontent) => {
|
||||||
note.content = newcontent
|
note.content = newcontent
|
||||||
|
|
||||||
|
dataApi.updateNote(storage.key, note.key, note)
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'UPDATE_NOTE',
|
type: 'UPDATE_NOTE',
|
||||||
note: note
|
note: note
|
||||||
|
|||||||
@@ -472,13 +472,28 @@ function importAttachments (markDownContent, filepath, storageKey, noteKey) {
|
|||||||
attachName = nameRegex.exec(markDownContent)
|
attachName = nameRegex.exec(markDownContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
Promise.all(promiseArray).then((fileNames) => {
|
let numResolvedPromises = 0
|
||||||
for (let j = 0; j < fileNames.length; j++) {
|
|
||||||
const newPath = path.join(STORAGE_FOLDER_PLACEHOLDER, noteKey, fileNames[j])
|
if (promiseArray.length === 0) {
|
||||||
markDownContent = markDownContent.replace(endPath[j], newPath)
|
|
||||||
}
|
|
||||||
resolve(markDownContent)
|
resolve(markDownContent)
|
||||||
})
|
}
|
||||||
|
|
||||||
|
for (let j = 0; j < promiseArray.length; j++) {
|
||||||
|
promiseArray[j]
|
||||||
|
.then((fileName) => {
|
||||||
|
const newPath = path.join(STORAGE_FOLDER_PLACEHOLDER, noteKey, fileName)
|
||||||
|
markDownContent = markDownContent.replace(endPath[j], newPath)
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.error('File does not exist in path: ' + endPath[j])
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
numResolvedPromises++
|
||||||
|
if (numResolvedPromises === promiseArray.length) {
|
||||||
|
resolve(markDownContent)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user