@@ -193,12 +193,14 @@
+ v-if="!ingredient.no_amount"
+ :id="`amount_${step_index}_${index}`">
-
+
{% trans 'You can use markdown to format this field. See the docs here' %}
@@ -447,6 +449,24 @@
this.searchUnits('')
this.searchFoods('')
this.searchKeywords('')
+
+ 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));
+ },
+ beforeDestroy() {
+ document.removeEventListener('keydown', this._keyListener);
},
methods: {
makeToast: function (title, message, variant = null) {
@@ -543,6 +563,8 @@
'no_amount': false
})
this.sortIngredients(step)
+ this.$nextTick(() => document.getElementById(`amount_${this.recipe.steps.indexOf(step)}_${step.ingredients.length - 1}`).focus())
+
},
removeIngredient: function (step, ingredient) {
if (confirm('{% trans 'Are you sure that you want to delete this ingredient?' %}')) {
diff --git a/cookbook/templates/recipe_view.html b/cookbook/templates/recipe_view.html
index 9e53b12dd..9211051fa 100644
--- a/cookbook/templates/recipe_view.html
+++ b/cookbook/templates/recipe_view.html
@@ -107,7 +107,7 @@
-
+
@@ -216,6 +216,10 @@
{% endif %}
+
+
{% trans 'Instructions' %}
+
+
{% for s in recipe.steps.all %}