refactor: handle uploading imported evernote attachments note-by-note instead of all at once
This commit is contained in:
@@ -176,10 +176,7 @@ export class Importer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getPayloadsFromFile(file: File, type: string): Promise<DecryptedTransferPayload[]> {
|
async getPayloadsFromFile(file: File, type: string): Promise<DecryptedTransferPayload[]> {
|
||||||
const isEntitledToSuper =
|
const isEntitledToSuper = this.isEntitledToSuper()
|
||||||
this.features.getFeatureStatus(
|
|
||||||
NativeFeatureIdentifier.create(NativeFeatureIdentifier.TYPES.SuperEditor).getValue(),
|
|
||||||
) === FeatureStatus.Entitled
|
|
||||||
|
|
||||||
if (type === 'super' && !isEntitledToSuper) {
|
if (type === 'super' && !isEntitledToSuper) {
|
||||||
throw new Error('Importing Super notes requires a subscription')
|
throw new Error('Importing Super notes requires a subscription')
|
||||||
|
|||||||
@@ -279,8 +279,8 @@ export class HeadlessSuperConverter implements SuperConverterServiceInterface {
|
|||||||
resolve()
|
resolve()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Promise.all(
|
;(async () => {
|
||||||
concatenatedNodes.map(async (node) => {
|
for (const node of concatenatedNodes) {
|
||||||
const blob = await fetch(node.__src).then((response) => response.blob())
|
const blob = await fetch(node.__src).then((response) => response.blob())
|
||||||
const name = $isInlineFileNode(node) ? node.__fileName : node.__alt
|
const name = $isInlineFileNode(node) ? node.__fileName : node.__alt
|
||||||
const mimeType = $isInlineFileNode(node) ? node.__mimeType : node.__src.split(';')[0].split(':')[1]
|
const mimeType = $isInlineFileNode(node) ? node.__mimeType : node.__src.split(';')[0].split(':')[1]
|
||||||
@@ -303,8 +303,8 @@ export class HeadlessSuperConverter implements SuperConverterServiceInterface {
|
|||||||
)
|
)
|
||||||
|
|
||||||
await linkFile(uploadedFile)
|
await linkFile(uploadedFile)
|
||||||
}),
|
}
|
||||||
)
|
})()
|
||||||
.then(() => resolve())
|
.then(() => resolve())
|
||||||
.catch(console.error)
|
.catch(console.error)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user