1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 15:49:42 +02:00

feat: Insert instruction step above or below. #3731 (#3732)

This commit is contained in:
Jonathan Beaulieu 2024-06-18 06:45:12 -07:00 committed by GitHub
parent 82d930e645
commit 20b1b3de35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 44 additions and 0 deletions

View file

@ -170,12 +170,22 @@
text: $tc('recipe.move-to-bottom'),
event: 'move-to-bottom',
},
{
text: $tc('recipe.insert-above'),
event: 'insert-above'
},
{
text: $tc('recipe.insert-below'),
event: 'insert-below'
},
],
},
]"
@merge-above="mergeAbove(index - 1, index)"
@move-to-top="moveTo('top', index)"
@move-to-bottom="moveTo('bottom', index)"
@insert-above="insert(index)"
@insert-below="insert(index+1)"
@toggle-section="toggleShowTitle(step.id)"
@link-ingredients="openDialog(index, step.text, step.ingredientReferences)"
@preview-step="togglePreviewState(index)"
@ -550,6 +560,10 @@ export default defineComponent({
}
}
function insert(dest: number) {
props.value.splice(dest, 0, { id: uuid4(), text: "", title: "", ingredientReferences: [] });
}
const previewStates = ref<boolean[]>([]);
function togglePreviewState(index: number) {
@ -681,6 +695,7 @@ export default defineComponent({
showCookMode,
isCookMode,
isEditForm,
insert,
};
},
});