fix drag and drop on recipe instructions

This commit is contained in:
Michael Genson 2025-06-16 19:41:28 +00:00
commit d6b8f03c5b

View file

@ -130,11 +130,10 @@
ghostClass: 'ghost', ghostClass: 'ghost',
}" }"
@start="drag = true" @start="drag = true"
@end="drag = false" @end="onDragEnd"
> >
<TransitionGroup <TransitionGroup
type="transition" type="transition"
:name="!drag ? 'flip-list' : ''"
> >
<div <div
v-for="(step, index) in instructionList" v-for="(step, index) in instructionList"
@ -512,13 +511,10 @@ export default defineNuxtComponent({
{ deep: true }, { deep: true },
); );
watch( function onDragEnd() {
instructionList, context.emit("update:modelValue", [...instructionList.value]);
(newVal) => { drag.value = false;
context.emit("update:modelValue", [...newVal]); }
},
{ deep: true },
);
// =============================================================== // ===============================================================
// Ingredient Linker // Ingredient Linker
@ -784,6 +780,7 @@ export default defineNuxtComponent({
loadingStates, loadingStates,
// Rest // Rest
onDragEnd,
drag, drag,
togglePreviewState, togglePreviewState,
toggleCollapseSection, toggleCollapseSection,