|
|
@ -95,29 +95,26 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState( |
|
|
|
new Promise<AttachmentProps>((resolve) => { |
|
|
|
new Promise<AttachmentProps>((resolve) => { |
|
|
|
const res: AttachmentProps = { ...file, file, title: file.name, mimetype: file.type } |
|
|
|
const res: AttachmentProps = { ...file, file, title: file.name, mimetype: file.type } |
|
|
|
|
|
|
|
|
|
|
|
renameFile(file).then((renamedFile) => { |
|
|
|
if (isImage(file.name, (<any>file).mimetype ?? file.type)) { |
|
|
|
if (isImage(renamedFile.name, (<any>renamedFile).mimetype ?? renamedFile.type)) { |
|
|
|
const reader = new FileReader() |
|
|
|
const reader = new FileReader() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reader.onload = (e) => { |
|
|
|
reader.onload = (e) => { |
|
|
|
res.data = e.target?.result |
|
|
|
res.data = e.target?.result |
|
|
|
|
|
|
|
|
|
|
|
resolve(res) |
|
|
|
resolve(res) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
reader.onerror = () => { |
|
|
|
|
|
|
|
resolve(res) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reader.readAsDataURL(file) |
|
|
|
reader.onerror = () => { |
|
|
|
} else { |
|
|
|
|
|
|
|
resolve(res) |
|
|
|
resolve(res) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
reader.readAsDataURL(file) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
resolve(res) |
|
|
|
|
|
|
|
} |
|
|
|
}), |
|
|
|
}), |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
attachments.value = [...attachments.value, ...newFiles] |
|
|
|
attachments.value = [...attachments.value, ...newFiles] |
|
|
|
|
|
|
|
|
|
|
|
return updateModelValue(attachments.value) |
|
|
|
return updateModelValue(attachments.value) |
|
|
@ -152,8 +149,6 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState( |
|
|
|
continue |
|
|
|
continue |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
file = await renameFile(file) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
files.push(file) |
|
|
|
files.push(file) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|