Skip to content

Commit

Permalink
fix dragging feature of slide toc
Browse files Browse the repository at this point in the history
  • Loading branch information
IshavSohal committed Aug 19, 2024
1 parent 1bab84d commit 6fab590
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/slide-toc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
</vue-final-modal>
</div>
<ul class="max-h-screen overflow-y-auto">
<draggable v-model="slides" @update="$emit('slides-updated', slides)" item-key="title" v-focus-list>
<draggable :list="slides" @update="$emit('slides-updated', slides)" :item-key="getSlideId" v-focus-list>
<template #item="{ element, index }">
<li
class="toc-slide border-t flex px-2 cursor-pointer hover:bg-gray-300"
Expand Down Expand Up @@ -324,6 +324,10 @@ export default class SlideTocV extends Vue {
this.slides.splice(index + 1, 0, this.slides.splice(index, 1)[0]);
this.$emit('slides-updated', this.slides);
}
getSlideId(slide: Slide): string {
return slide.title + this.slides.indexOf(slide);
}
}
</script>

Expand Down

0 comments on commit 6fab590

Please sign in to comment.