fix: back button not wroking on settings

This commit is contained in:
PandaDEV 2025-01-01 17:43:35 +10:00
parent e29f2fcfa5
commit b3daaaa633
No known key found for this signature in database
GPG key ID: 13EFF9BAF70EE75C
2 changed files with 36 additions and 23 deletions

View file

@ -43,6 +43,7 @@ $mutedtext: #78756F;
justify-content: center; justify-content: center;
height: 100vh; height: 100vh;
gap: 6px; gap: 6px;
z-index: -1;
.title { .title {
font-size: 20px; font-size: 20px;

View file

@ -1,9 +1,9 @@
<template> <template>
<div class="bg"> <div class="bg">
<div class="back"> <NuxtLink to="/" class="back">
<img @click="router.push('/')" src="../public/back_arrow.svg" /> <img src="../public/back_arrow.svg" />
<p>Back</p> <p>Back</p>
</div> </NuxtLink>
<div class="bottom-bar"> <div class="bottom-bar">
<div class="left"> <div class="left">
<img alt="" class="logo" src="../public/logo.png" width="18px" /> <img alt="" class="logo" src="../public/logo.png" width="18px" />
@ -154,29 +154,41 @@ const saveKeybind = async () => {
onMounted(() => { onMounted(() => {
os.value = platform(); os.value = platform();
keyboard.down("all", (event) => { keyboard.down("MetaLeft+Enter", (event) => {
const isMacSaveCombo = if (os.value === "macos" && !isKeybindInputFocused.value) {
os.value === "macos" && console.log("Save on macOS")
(event.code === "MetaLeft" || event.code === "MetaRight") && event.preventDefault()
event.key === "Enter"; saveKeybind()
const isOtherOsSaveCombo =
os.value !== "macos" &&
(event.code === "ControlLeft" || event.code === "ControlRight") &&
event.key === "Enter";
if (
(isMacSaveCombo || isOtherOsSaveCombo) &&
!isKeybindInputFocused.value
) {
event.preventDefault();
saveKeybind();
} }
}); })
keyboard.down("MetaRight+Enter", (event) => {
if (os.value === "macos" && !isKeybindInputFocused.value) {
console.log("Save on macOS")
event.preventDefault()
saveKeybind()
}
})
keyboard.down("ControlLeft+Enter", (event) => {
if (os.value !== "macos" && !isKeybindInputFocused.value) {
console.log("Save on other OS")
event.preventDefault()
saveKeybind()
}
})
keyboard.down("ControlRight+Enter", (event) => {
if (os.value !== "macos" && !isKeybindInputFocused.value) {
console.log("Save on other OS")
event.preventDefault()
saveKeybind()
}
})
keyboard.down("Escape", (event) => { keyboard.down("Escape", (event) => {
const now = Date.now(); console.log("Escape");
if (!isKeybindInputFocused.value && now - lastBlurTime.value > 100) { if (!isKeybindInputFocused.value) {
event.preventDefault(); event.preventDefault();
router.push("/"); router.push("/");
} }