mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 02:00:31 +08:00
Submit the issue modal with Cmd+Return from title
Closes c4c2391d309ccff1cd745d5e98faf5b4e9bb7d9d
This commit is contained in:
committed by
Rūdolfs Ošiņš
parent
ba5e571337
commit
e97af99286
@@ -4,6 +4,8 @@
|
||||
|
||||
import { onMount } from "svelte";
|
||||
|
||||
import * as utils from "@app/lib/utils";
|
||||
|
||||
interface Props {
|
||||
autofocus?: boolean;
|
||||
autoselect?: boolean;
|
||||
@@ -15,6 +17,7 @@
|
||||
onFocus?: () => void;
|
||||
onBlur?: () => void;
|
||||
onSubmit?: () => void;
|
||||
onModifierSubmit?: () => void;
|
||||
oninput?: FormEventHandler<HTMLInputElement>;
|
||||
placeholder?: string;
|
||||
type?: string;
|
||||
@@ -35,6 +38,7 @@
|
||||
onFocus,
|
||||
onBlur,
|
||||
onSubmit,
|
||||
onModifierSubmit,
|
||||
oninput,
|
||||
placeholder,
|
||||
type = "text",
|
||||
@@ -65,6 +69,13 @@
|
||||
|
||||
function handleKeydown(event: KeyboardEvent) {
|
||||
event.stopPropagation();
|
||||
const auxiliarKey = utils.isMac() ? event.metaKey : event.ctrlKey;
|
||||
if (auxiliarKey && event.key === "Enter" && onModifierSubmit) {
|
||||
event.preventDefault();
|
||||
onModifierSubmit();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.key === "Enter" && valid && onSubmit) {
|
||||
onSubmit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user