mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-25 08:09:41 +02:00
Add shopping list items using the enter key (#3118)
* Enables shopping list items being saved upon enter key press in notes field Related to: https://github.com/mealie-recipes/mealie/discussions/3114 * Enter key press is caught in note field in ShoppingListItemEditor * The create editor now stays open after saving a food item to a shopping list, to allow keyboard-only interaction with the shopping list * Prevent empty shopping list items from being added Related to: https://github.com/mealie-recipes/mealie/discussions/3114 An item is considered empty when the foodId is not set, and no note is set. This is only handled frontend, the backend still accepts empty items. --------- Signed-off-by: Jurriaan Den Toonder <1493561+Fastjur@users.noreply.github.com> Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
This commit is contained in:
parent
7e194887f5
commit
4d2363ea22
2 changed files with 15 additions and 1 deletions
|
@ -25,6 +25,7 @@
|
|||
:label="$t('shopping-list.note')"
|
||||
rows="1"
|
||||
auto-grow
|
||||
@keypress="handleNoteKeyPress"
|
||||
></v-textarea>
|
||||
</div>
|
||||
<div class="d-flex align-end" style="gap: 20px">
|
||||
|
@ -142,5 +143,14 @@ export default defineComponent({
|
|||
listItem,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
handleNoteKeyPress(event) {
|
||||
// Save on Enter
|
||||
if (!event.shiftKey && event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
this.$emit("save");
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue