Revert change.

This commit is contained in:
Paul 2021-07-05 21:28:38 +01:00
parent b8a4ada30c
commit c11d10a265

View file

@ -68,11 +68,6 @@ const Base = styled.div`
font-size: 0.875rem; font-size: 0.875rem;
background: transparent; background: transparent;
} }
.textarea {
flex-grow: 1;
padding: 12px 0;
}
`; `;
const Blocked = styled.div` const Blocked = styled.div`
@ -424,64 +419,62 @@ function MessageBox({ channel, draft }: Props) {
/> />
</Action> </Action>
) : undefined} ) : undefined}
<div class="textarea"> <TextAreaAutoSize
<TextAreaAutoSize autoFocus
autoFocus hideBorder
hideBorder maxRows={20}
maxRows={20} padding={12}
padding={0} id="message"
id="message" value={draft ?? ""}
value={draft ?? ""} onKeyUp={onKeyUp}
onKeyUp={onKeyUp} onKeyDown={(e) => {
onKeyDown={(e) => { if (onKeyDown(e)) return;
if (onKeyDown(e)) return;
if ( if (
e.key === "ArrowUp" && e.key === "ArrowUp" &&
(!draft || draft.length === 0) (!draft || draft.length === 0)
) { ) {
e.preventDefault(); e.preventDefault();
internalEmit("MessageRenderer", "edit_last"); internalEmit("MessageRenderer", "edit_last");
return; return;
}
if (
!e.shiftKey &&
e.key === "Enter" &&
!isTouchscreenDevice
) {
e.preventDefault();
return send();
}
debouncedStopTyping(true);
}}
placeholder={
channel.channel_type === "DirectMessage"
? translate("app.main.channel.message_who", {
person: client.users.get(
client.channels.getRecipient(channel._id),
)?.username,
})
: channel.channel_type === "SavedMessages"
? translate("app.main.channel.message_saved")
: translate("app.main.channel.message_where", {
channel_name: channel.name,
})
} }
disabled={
uploadState.type === "uploading" || if (
uploadState.type === "sending" !e.shiftKey &&
e.key === "Enter" &&
!isTouchscreenDevice
) {
e.preventDefault();
return send();
} }
onChange={(e) => {
setMessage(e.currentTarget.value); debouncedStopTyping(true);
startTyping(); }}
onChange(e); placeholder={
}} channel.channel_type === "DirectMessage"
onFocus={onFocus} ? translate("app.main.channel.message_who", {
onBlur={onBlur} person: client.users.get(
/> client.channels.getRecipient(channel._id),
</div> )?.username,
})
: channel.channel_type === "SavedMessages"
? translate("app.main.channel.message_saved")
: translate("app.main.channel.message_where", {
channel_name: channel.name,
})
}
disabled={
uploadState.type === "uploading" ||
uploadState.type === "sending"
}
onChange={(e) => {
setMessage(e.currentTarget.value);
startTyping();
onChange(e);
}}
onFocus={onFocus}
onBlur={onBlur}
/>
{isTouchscreenDevice && ( {isTouchscreenDevice && (
<Action> <Action>
<IconButton onClick={send}> <IconButton onClick={send}>