Close/cancel draft "reply to" on Escape (#4387)

This commit is contained in:
Jan Janik
2020-07-01 03:59:38 +02:00
committed by GitHub
parent c907fd36ba
commit 1503053496
3 changed files with 14 additions and 3 deletions

View File

@@ -42,6 +42,8 @@ export type Props = {
onTextTooLong(): unknown;
onPickEmoji(o: EmojiPickDataType): unknown;
onSubmit(message: string): unknown;
getQuotedMessage(): unknown;
clearQuotedMessage(): unknown;
};
export type InputApi = {
@@ -217,6 +219,8 @@ export const CompositionInput = ({
onSubmit,
skinTone,
startingText,
getQuotedMessage,
clearQuotedMessage,
}: Props) => {
const [editorRenderState, setEditorRenderState] = React.useState(
getInitialEditorState(startingText)
@@ -462,6 +466,8 @@ export const CompositionInput = ({
if (emojiResults.length > 0) {
e.preventDefault();
resetEmojiResults();
} else if (getQuotedMessage()) {
clearQuotedMessage();
}
},
[resetEmojiResults, emojiResults]