use Shift + Enter to create and add another
@@ -69,7 +67,13 @@ const api = useUserApi(); const toast = useNotifier(); - async function create(close: boolean) { + const { shift } = useMagicKeys(); + + async function create(close = true) { + if (shift.value) { + close = false; + } + const { error, data } = await api.labels.create(form); if (error) { toast.error("Couldn't create label"); @@ -84,16 +88,4 @@ navigateTo(`/label/${data.id}`); } } - - async function keySubmit(e: KeyboardEvent) { - // Shift + Enter - if (e.shiftKey && e.key === "Enter") { - e.preventDefault(); - await create(false); - focused.value = true; - } else if (e.key === "Enter") { - e.preventDefault(); - await create(true); - } - } diff --git a/frontend/components/Location/CreateModal.vue b/frontend/components/Location/CreateModal.vue index f87715a..d0dadbb 100644 --- a/frontend/components/Location/CreateModal.vue +++ b/frontend/components/Location/CreateModal.vue @@ -1,7 +1,7 @@use Shift + Enter to create and add another
@@ -71,9 +69,15 @@ const api = useUserApi(); const toast = useNotifier(); - async function create(close: boolean) { + const { shift } = useMagicKeys(); + + async function create(close = true) { loading.value = true; + if (shift.value) { + close = false; + } + const { data, error } = await api.locations.create({ name: form.name, description: form.description, @@ -94,16 +98,4 @@ navigateTo(`/location/${data.id}`); } } - - async function keySubmit(e: KeyboardEvent) { - // Shift + Enter - if (e.shiftKey && e.key === "Enter") { - e.preventDefault(); - await create(false); - focused.value = true; - } else if (e.key === "Enter") { - e.preventDefault(); - await create(true); - } - } diff --git a/frontend/pages/profile.vue b/frontend/pages/profile.vue index 5788d74..bc3273a 100644 --- a/frontend/pages/profile.vue +++ b/frontend/pages/profile.vue @@ -288,20 +288,22 @@