From 61289416a5c8582d517eeb1c34323ed7a3cbf1fc Mon Sep 17 00:00:00 2001 From: Michael Genson <71845777+michael-genson@users.noreply.github.com> Date: Mon, 22 Jan 2024 14:21:04 -0600 Subject: [PATCH] feat: Add Ingredient Sections To Copied Ingredients (#3032) * add ingredient title to copied text * fix double linebreak * lint --------- Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com> --- .../Domain/Recipe/RecipeIngredients.vue | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/frontend/components/Domain/Recipe/RecipeIngredients.vue b/frontend/components/Domain/Recipe/RecipeIngredients.vue index 8be0b433a3d..3769243c13f 100644 --- a/frontend/components/Domain/Recipe/RecipeIngredients.vue +++ b/frontend/components/Domain/Recipe/RecipeIngredients.vue @@ -52,11 +52,20 @@ export default defineComponent({ }); const ingredientCopyText = computed(() => { - return props.value - .map((ingredient) => { - return `${parseIngredientText(ingredient, props.disableAmount, props.scale, false)}`; - }) - .join("\n"); + const components: string[] = []; + props.value.forEach((ingredient) => { + if (ingredient.title) { + if (components.length) { + components.push(""); + } + + components.push(`[${ingredient.title}]`); + } + + components.push(parseIngredientText(ingredient, props.disableAmount, props.scale, false)); + }); + + return components.join("\n"); }); function toggleChecked(index: number) {