Skip to content

Commit

Permalink
feat: Add Ingredient Sections To Copied Ingredients (#3032)
Browse files Browse the repository at this point in the history
* add ingredient title to copied text

* fix double linebreak

* lint

---------

Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
  • Loading branch information
michael-genson and Kuchenpirat authored Jan 22, 2024
1 parent 16d3dbe commit 6128941
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions frontend/components/Domain/Recipe/RecipeIngredients.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6128941

Please sign in to comment.