diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 1ff6b4c3..8e28c91b 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -339,7 +339,8 @@ v-bind:class="{ 'col-lg-4 col-md-6': !ingredient.is_header, 'col-lg-12 col-md-12': ingredient.is_header }"> + v-bind:placeholder="$t('Note')" + v-on:keydown.tab="event => {if(step.ingredients.indexOf(ingredient) === (step.ingredients.length -1)){event.preventDefault();addIngredient(step)}}"> @@ -455,12 +456,12 @@
-
-
@@ -537,28 +538,14 @@ export default { this.searchRecipes('') - //TODO find out what this did and fix it - // this._keyListener = function (e) { - // if (e.code === "Space" && e.ctrlKey) { - // e.preventDefault(); // present "Save Page" from getting triggered. - // - // for (el of e.path) { - // if (el.id !== undefined && el.id.includes('id_card_step_')) { - // let step = this.recipe.steps[el.id.replace('id_card_step_', '')] - // this.addIngredient(step) - // } - // } - // } - // }; - // document.addEventListener('keydown', this._keyListener.bind(this)); - this.$i18n.locale = window.CUSTOM_LOCALE }, created() { + window.addEventListener('keydown', this.keyboardListener); window.addEventListener('beforeunload', this.warnPageLeave) }, beforeUnmount() { - document.removeEventListener('keydown', this._keyListener); + window.removeEventListener('keydown', this.keyboardListener); }, watch: { recipe: { @@ -569,8 +556,25 @@ export default { } }, methods: { - test: function (event) { - console.log(event) + keyboardListener: function (e) { + if (e.code === "Space" && e.ctrlKey) { + e.preventDefault(); // present "Save Page" from getting triggered. + + for (let el of e.path) { + if (el.id !== undefined && el.id.includes('id_card_step_')) { + let step = this.recipe.steps[el.id.replace('id_card_step_', '')] + this.addIngredient(step) + } + } + } + if (e.code === "KeyS" && e.ctrlKey && !e.shiftKey) { + e.preventDefault(); + this.updateRecipe(false) + } + if (e.code === "KeyS" && e.ctrlKey && e.shiftKey) { + e.preventDefault(); + this.updateRecipe(true) + } }, warnPageLeave: function (event) { if (this.recipe_changed) { @@ -674,7 +678,6 @@ export default { }) this.sortIngredients(step) this.$nextTick(() => document.getElementById(`amount_${this.recipe.steps.indexOf(step)}_${step.ingredients.length - 1}`).focus()) - }, removeIngredient: function (step, ingredient) { if (confirm(this.$t('confirm_delete', {object: this.$t('Ingredient')}))) { @@ -826,7 +829,7 @@ export default { margin-top: 2px; } -textarea { +textarea:not(.form-control) { border: 0 !important; } diff --git a/vue/src/locales/en.json b/vue/src/locales/en.json index 133783f9..51fae616 100644 --- a/vue/src/locales/en.json +++ b/vue/src/locales/en.json @@ -9,13 +9,11 @@ "success_deleting_resource": "Successfully deleted a resource!", "step_time_minutes": "Step time in minutes", "confirm_delete": "Are you sure you want to delete this {object}?", - "import_running": "Import running, please wait!", "all_fields_optional": "All fields are optional and can be left empty.", "convert_internal": "Convert to internal recipe", "show_only_internal": "Show only internal recipes", "show_split_screen": "Split View", - "Log_Recipe_Cooking": "Log Recipe Cooking", "External_Recipe_Image": "External Recipe Image", "Add_to_Shopping": "Add to Shopping", @@ -27,7 +25,6 @@ "Hide_as_header": "Hide as header", "Copy_template_reference": "Copy template reference", "Save_and_View": "Save & View", - "Manage_Books": "Manage Books", "Meal_Plan": "Meal Plan", "Select_Book": "Select Book", @@ -57,7 +54,6 @@ "Enable_Amount": "Enable Amount", "Disable_Amount": "Disable Amount", "Add_Step": "Add Step", - "Keywords": "Keywords", "Books": "Books", "Proteins": "Proteins", @@ -150,6 +146,8 @@ "and_up": "& Up", "Instructions": "Instructions", "Unrated": "Unrated", + "Key_Ctrl": "Ctrl", + "Key_Shift": "Shift", "Time": "Time", "Text": "Text" }