Tastenkürzel: Abschicken mit Strg+Enter statt Shift+Enter
Strg+Enter ist das übliche Kürzel zum Absenden mehrzeiliger Eingaben; Shift+Enter bedeutet anderswo meist Zeilenumbruch und schickt hier leicht versehentlich ab. Cmd+Enter gilt auf dem Mac genauso. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { useState, type FormEvent } from "react";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { api, errMsg } from "../api";
|
||||
import { submitOnShiftEnter } from "../keys";
|
||||
import { submitOnCtrlEnter } from "../keys";
|
||||
import { pasteImage } from "../paste";
|
||||
|
||||
// PostForm verfasst einen Beitrag, mit replyTo eine Antwort darauf.
|
||||
// Abgeschickt wird per Knopf oder mit Shift+Enter aus dem Textfeld heraus
|
||||
// (siehe submitOnShiftEnter).
|
||||
// Abgeschickt wird per Knopf oder mit Strg+Enter aus dem Textfeld heraus
|
||||
// (siehe submitOnCtrlEnter).
|
||||
export function PostForm({ replyTo, rows, placeholder, submitLabel, fallback, onDone }: {
|
||||
replyTo?: string;
|
||||
rows: number;
|
||||
@@ -47,11 +47,11 @@ export function PostForm({ replyTo, rows, placeholder, submitLabel, fallback, on
|
||||
rows={rows}
|
||||
maxLength={1000}
|
||||
placeholder={placeholder}
|
||||
onKeyDown={submitOnShiftEnter}
|
||||
onKeyDown={submitOnCtrlEnter}
|
||||
></textarea>{" "}
|
||||
<p className="muted">{pasteMsg}</p>{" "}
|
||||
<input name="file" type="file" accept="image/*" />{" "}
|
||||
<button type="submit" title="Shift+Enter" disabled={create.isPending}>{submitLabel}</button>
|
||||
<button type="submit" title="Strg+Enter" disabled={create.isPending}>{submitLabel}</button>
|
||||
</form>
|
||||
<p className="msg">{create.isError ? errMsg(create.error, fallback) : ""}</p>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user