Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
savayer committed Mar 31, 2024
2 parents 4828e11 + b462cf8 commit df2f9e5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pages/admin/words-matcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,13 @@
}
async function addNewWord() {
await $api.admin.addNewWordToDatabase(inputWord.value, 'bur', 'ru');
const word = await $api.admin.addNewWordToDatabase(
inputWord.value.toLowerCase(),
'bur',
'ru',
);
await searchWord(inputWord.value);
addSuggestedWord(word);
}
async function syncWord() {
Expand Down Expand Up @@ -312,24 +317,24 @@
}
}
async function handleSaveShortcut(event: KeyboardEvent) {
async function handleShortcuts(event: KeyboardEvent) {
// saving
if ((event.ctrlKey || event.metaKey) && event.key === 's') {
event.preventDefault();
await syncWord();
}
if ((event.ctrlKey || event.metaKey) && event.key === 'n') {
if ((event.ctrlKey || event.metaKey) && event.key === 'm') {
event.preventDefault();
await loadAnotherWord();
}
}
onMounted(() => {
window.addEventListener('keydown', handleSaveShortcut);
document.addEventListener('keydown', handleShortcuts);
});
onUnmounted(() => {
window.removeEventListener('keydown', handleSaveShortcut);
document.removeEventListener('keydown', handleShortcuts);
});
</script>

0 comments on commit df2f9e5

Please sign in to comment.