Add file pasting and drag-n-drop.

This commit is contained in:
Paul
2021-06-22 12:08:39 +01:00
parent 454ee7fd6e
commit 56dda66c1c
2 changed files with 74 additions and 3 deletions

View File

@@ -255,6 +255,13 @@ function MessageBox({ channel, draft, dispatcher }: Props) {
remove={async () => setUploadState({ type: "none" })}
onChange={files => setUploadState({ type: "attached", files })}
cancel={() => uploadState.type === 'uploading' && uploadState.cancel.cancel("cancel")}
append={files => {
if (uploadState.type === 'none') {
setUploadState({ type: 'attached', files });
} else if (uploadState.type === 'attached') {
setUploadState({ type: 'attached', files: [ ...uploadState.files, ...files ] });
}
}}
/>
</Action>
<TextAreaAutoSize