From d16bd537f245829ec3821714f8aec3a1ed9c2834 Mon Sep 17 00:00:00 2001 From: joe-allen-89 <85872286+joe-allen-89@users.noreply.github.com> Date: Tue, 11 Jun 2024 11:26:30 +0100 Subject: [PATCH] Fix: remove check for canCycleThroughPagination (fixes #286) (#303) * Fix: remove check for canCycleThroughPagination * canCycleThroughPagination check removed from setupBackNextLabels --- js/NarrativeView.js | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/js/NarrativeView.js b/js/NarrativeView.js index 67b05f0..9d3b359 100644 --- a/js/NarrativeView.js +++ b/js/NarrativeView.js @@ -232,10 +232,9 @@ class NarrativeView extends ComponentView { */ manageBackNextStates(index = this.model.getActiveItem().get('_index')) { const totalItems = this.model.getChildren().length; - const canCycleThroughPagination = this.model.get('_canCycleThroughPagination'); - const shouldEnableBack = index > 0 || canCycleThroughPagination; - const shouldEnableNext = index < totalItems - 1 || canCycleThroughPagination; + const shouldEnableBack = index > 0; + const shouldEnableNext = index < totalItems - 1; this.model.set('shouldEnableBack', shouldEnableBack); this.model.set('shouldEnableNext', shouldEnableNext); @@ -248,7 +247,6 @@ class NarrativeView extends ComponentView { */ setupBackNextLabels(index = this.model.getActiveItem().get('_index')) { const totalItems = this.model.getChildren().length; - const canCycleThroughPagination = this.model.get('_canCycleThroughPagination'); const isAtStart = index === 0; const isAtEnd = index === totalItems - 1; @@ -262,15 +260,13 @@ class NarrativeView extends ComponentView { let backItem = isAtStart ? null : index; let nextItem = isAtEnd ? null : index + 2; - if (canCycleThroughPagination) { - if (isAtStart) { - prevTitle = this.model.getItem(totalItems - 1).get('title'); - backItem = totalItems; - } - if (isAtEnd) { - nextTitle = this.model.getItem(0).get('title'); - nextItem = 1; - } + if (isAtStart) { + prevTitle = this.model.getItem(totalItems - 1).get('title'); + backItem = totalItems; + } + if (isAtEnd) { + nextTitle = this.model.getItem(0).get('title'); + nextItem = 1; } const backLabel = compile(narrativeGlobals.previous, {