fix: ctrl + enter in forms, close #362

This commit is contained in:
Xylight committed 2024-07-20 11:49:05 -07:00
1 parent b7e503ae4f
commit 5ea1f2e0cf
2 files changed
+11 -3

No files matched your search

@@ -105,7 +105,11 @@
KeyS: () => wrapSelection('~~', '~~'),
KeyH: () => wrapSelection('\n# ', ''),
KeyK: () => wrapSelection('[](', ')'),
Enter: () => dispatcher('confirm', value),
Enter: (e: any) => {
dispatcher('confirm', value)
const newEvent = new Event('submit', { cancelable: true })
e.target.form.dispatchEvent(newEvent)
},
}
</script>
@@ -295,7 +299,7 @@ overflow-hidden transition-colors"
let shortcut = shortcuts[e.code]
if (shortcut) {
e.preventDefault()
shortcut?.()
shortcut?.(e)
}
}
}}