enhancement: disable submit via enter on mobile

This commit is contained in:
Timothy J. Baek 2024-04-27 20:53:52 -04:00
parent e71ef42155
commit f1d2340861

View file

@ -689,13 +689,14 @@
: $i18n.t('Send a Message')} : $i18n.t('Send a Message')}
bind:value={prompt} bind:value={prompt}
on:keypress={(e) => { on:keypress={(e) => {
if (window.innerWidth > 1024) {
if (e.keyCode == 13 && !e.shiftKey) { if (e.keyCode == 13 && !e.shiftKey) {
e.preventDefault(); e.preventDefault();
} }
if (prompt !== '' && e.keyCode == 13 && !e.shiftKey) { if (prompt !== '' && e.keyCode == 13 && !e.shiftKey) {
// TODO: Only if screensize > xl
submitPrompt(prompt, user); submitPrompt(prompt, user);
} }
}
}} }}
on:keydown={async (e) => { on:keydown={async (e) => {
const isCtrlPressed = e.ctrlKey || e.metaKey; // metaKey is for Cmd key on Mac const isCtrlPressed = e.ctrlKey || e.metaKey; // metaKey is for Cmd key on Mac