From c5927cfc4b8cf7b971bf96dfb3d7888c584415bd Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Tue, 20 Oct 2020 14:31:10 +1100 Subject: [PATCH] focus composition box after adding an attachment --- .../session/conversation/SessionCompositionBox.tsx | 10 +++++++--- ts/session/utils/Toast.ts | 1 - 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ts/components/session/conversation/SessionCompositionBox.tsx b/ts/components/session/conversation/SessionCompositionBox.tsx index a5f87ddeb..600ba47b1 100644 --- a/ts/components/session/conversation/SessionCompositionBox.tsx +++ b/ts/components/session/conversation/SessionCompositionBox.tsx @@ -530,6 +530,7 @@ export class SessionCompositionBox extends React.Component { const objectUrl = URL.createObjectURL(file); try { const type = 'image/png'; + const thumbnail = await VisualAttachment.makeVideoScreenshot({ objectUrl, contentType: type, @@ -664,9 +665,12 @@ export class SessionCompositionBox extends React.Component { if (attachment.isVoiceMessage && stagedAttachments.length > 0) { throw new Error('A voice note cannot be sent with other attachments'); } - this.setState({ - stagedAttachments: [...stagedAttachments, { ...attachment }], - }); + this.setState( + { + stagedAttachments: [...stagedAttachments, { ...attachment }], + }, + this.focusCompositionBox + ); } private async autoScale( diff --git a/ts/session/utils/Toast.ts b/ts/session/utils/Toast.ts index 664fc3cb1..b60f89e1f 100644 --- a/ts/session/utils/Toast.ts +++ b/ts/session/utils/Toast.ts @@ -17,7 +17,6 @@ export function pushLoadAttachmentFailure() { }); } - export function pushDangerousFileError() { window.pushToast({ title: window.i18n('dangerousFileType'),