mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-13 13:17:45 +02:00
UBER-395: Allow to drop images into description (#3382)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -138,7 +138,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function createAttachment (file: File) {
|
||||
async function createAttachment (file: File): Promise<{ file: string; type: string } | undefined> {
|
||||
if (space === undefined || objectId === undefined || _class === undefined) return
|
||||
try {
|
||||
const uuid = await uploadFile(file)
|
||||
@@ -164,6 +164,7 @@
|
||||
saveDraft()
|
||||
dispatch('attach', { action: 'saved', value: attachments.size })
|
||||
dispatch('attached', _id)
|
||||
return { file: uuid, type: file.type }
|
||||
} catch (err: any) {
|
||||
setPlatformStatus(unknownError(err))
|
||||
}
|
||||
@@ -199,6 +200,7 @@
|
||||
removedAttachments.add(attachment)
|
||||
attachments.delete(attachment._id)
|
||||
attachments = attachments
|
||||
refInput.removeAttachment(attachment.file)
|
||||
saveDraft()
|
||||
dispatch('detached', attachment._id)
|
||||
}
|
||||
@@ -367,6 +369,9 @@
|
||||
on:attach={() => {
|
||||
attach()
|
||||
}}
|
||||
attachFile={async (file) => {
|
||||
return createAttachment(file)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{#if attachments.size && enableAttachments}
|
||||
|
||||
Reference in New Issue
Block a user