added shortcut to reply

This commit is contained in:
thislight 2024-09-28 15:29:21 +08:00
parent e0d1136230
commit 40cb0a0681
4 changed files with 43 additions and 13 deletions

View file

@ -198,7 +198,6 @@ const TootComposer: Component<{
client?: mastodon.rest.Client;
inReplyToId?: string;
onSent?: (status: mastodon.v1.Status) => void;
inputProps?: JSX.TextareaHTMLAttributes<HTMLTextAreaElement>;
}> = (props) => {
let inputRef: HTMLTextAreaElement;
let sendKey: string | undefined;
@ -217,6 +216,12 @@ const TootComposer: Component<{
setLanguage(lang);
});
createEffect(() => {
if (typing()) {
setTimeout(() => inputRef.focus(), 0);
}
});
onMount(() => {
makeEventListener(inputRef, "focus", () => setTyping(true));
});
@ -312,7 +317,6 @@ const TootComposer: Component<{
}
style={{ width: "100%", border: "none" }}
disabled={sending()}
{...props.inputProps}
></textarea>
<Show when={props.client}>
<Show