Skip to content

Commit

Permalink
fix(client): fix fragments for a last page
Browse files Browse the repository at this point in the history
fixes: #424
  • Loading branch information
hiroppy committed Mar 14, 2021
1 parent b17172f commit 0d866fe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/client/src/utils/getSlideIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ export function getSlideIndex({ next, slides, currentIndex, timeline, currentFra
if (next === '+') {
nextIndex = Math.min(currentIndex + 1, slides.length - 1);

if (Array.isArray(timeline[nextIndex])) {
// the last page and not first time
if (slides.length - 1 === currentIndex && Array.isArray(timeline[nextIndex])) {
nextCurrentFragmentSteps = Math.min(currentFragmentSteps + 1, timeline[nextIndex].length);
} else if (Array.isArray(timeline[nextIndex])) {
nextCurrentFragmentSteps = 0;
} else if (Array.isArray(timeline[currentIndex])) {
nextCurrentFragmentSteps = currentFragmentSteps + 1;
Expand Down
11 changes: 11 additions & 0 deletions packages/playground/debug/slides/10-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# the end

<!-- fragments-start -->

a

b

c

<!-- fragments-end -->

0 comments on commit 0d866fe

Please sign in to comment.