compositionbox

pull/1102/head
Vincent 5 years ago
parent 35218ec2d1
commit 5b69f19410

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

@ -211,14 +211,14 @@ $composition-container-height: 60px;
.send-message-input { .send-message-input {
display: flex; display: flex;
align-items: center;
flex-grow: 1; flex-grow: 1;
min-height: $composition-container-height; min-height: $composition-container-height;
padding: 16px 0px;
textarea { textarea {
font-family: $session-font-default; font-family: $session-font-default;
min-height: $composition-container-height / 3; min-height: $composition-container-height / 3;
max-height: 2 * $composition-container-height; max-height: 3 * $composition-container-height;
margin-right: $session-margin-md; margin-right: $session-margin-md;
color: $session-color-white; color: $session-color-white;
resize: none; resize: none;

@ -75,6 +75,9 @@ export class SessionCompositionBox extends React.Component<Props, State> {
this.onChoseAttachment = this.onChoseAttachment.bind(this); this.onChoseAttachment = this.onChoseAttachment.bind(this);
this.onChooseAttachment = this.onChooseAttachment.bind(this); this.onChooseAttachment = this.onChooseAttachment.bind(this);
// On Sending
this.onSendMessage = this.onSendMessage.bind(this);
// Events // Events
this.onKeyDown = this.onKeyDown.bind(this); this.onKeyDown = this.onKeyDown.bind(this);
this.onChange = this.onChange.bind(this); this.onChange = this.onChange.bind(this);
@ -177,6 +180,7 @@ export class SessionCompositionBox extends React.Component<Props, State> {
<TextareaAutosize <TextareaAutosize
rows={1} rows={1}
maxRows={3} maxRows={3}
ref={this.textarea}
spellCheck={false} spellCheck={false}
placeholder={placeholder} placeholder={placeholder}
maxLength={Constants.CONVERSATION.MAX_MESSAGE_BODY_LENGTH} maxLength={Constants.CONVERSATION.MAX_MESSAGE_BODY_LENGTH}
@ -216,14 +220,15 @@ export class SessionCompositionBox extends React.Component<Props, State> {
} }
private onChooseAttachment() { private onChooseAttachment() {
const fileInput = this.fileInput.current; this.fileInput.current?.click();
if (fileInput) fileInput.click();
} }
private onChoseAttachment() { private onChoseAttachment() {
// Build attachments list // Build attachments list
const attachmentsFileList = this.fileInput.current?.files; const attachmentsFileList = this.fileInput.current?.files;
if (!attachmentsFileList) return; if (!attachmentsFileList) {
return;
}
const attachments: Array<Attachment> = []; const attachments: Array<Attachment> = [];
Array.from(attachmentsFileList).forEach(async (file: File) => { Array.from(attachmentsFileList).forEach(async (file: File) => {
@ -371,6 +376,7 @@ export class SessionCompositionBox extends React.Component<Props, State> {
// On drop attachments! // On drop attachments!
// this.textarea.current?.ondrop; // this.textarea.current?.ondrop;
// Look into react-dropzone // Look into react-dropzone
// DROP AREA COMES FROM SessionConversation NOT HERE
} }
private onChange(event: any) { private onChange(event: any) {
@ -406,7 +412,8 @@ export class SessionCompositionBox extends React.Component<Props, State> {
} }
private onTextareaContainerClick() { private onTextareaContainerClick() {
// Focus textarea when user clicks anywhere in the container // Focus the textarea when user clicks anywhere in the composition box
this.textarea.current?.focus(); setTimeout(() => this.textarea.current?.focus(), 50);
} }
} }

Loading…
Cancel
Save