From b3a7a632c7a29a036bc9eedb7c12aed30f538436 Mon Sep 17 00:00:00 2001 From: Thomas Reitmayr Date: Tue, 5 Dec 2023 05:25:20 +0100 Subject: [PATCH] Fix default substep order when no explicit order given (#855) (#856) This affects both going to the next and previous substep. --- js/impress.js | 8 +++++++- src/plugins/substep/substep.js | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/js/impress.js b/js/impress.js index 46cd7d1..3528ef2 100644 --- a/js/impress.js +++ b/js/impress.js @@ -8,7 +8,7 @@ * in modern browsers and inspired by the idea behind prezi.com. * * - * Copyright 2011-2012 Bartek Szopka (@bartaz), 2016-2023 Henrik Ingo (@henrikingo) + * Copyright 2011-2012 Bartek Szopka (@bartaz), 2016-2023 Henrik Ingo (@henrikingo) * and 70+ other contributors * * Released under the MIT License. @@ -4709,6 +4709,11 @@ currentSubstepOrder = el.dataset.substepOrder; el.classList.add( "substep-visible" ); el.classList.add( "substep-active" ); + if ( currentSubstepOrder === undefined ) { + + // Stop after one substep as default order + break; + } } return el; @@ -4741,6 +4746,7 @@ // Continue if there is another substep with the same substepOrder if ( current > 0 && + visible[ current ].dataset.substepOrder !== undefined && visible[ current - 1 ].dataset.substepOrder === visible[ current ].dataset.substepOrder ) { visible.pop(); diff --git a/src/plugins/substep/substep.js b/src/plugins/substep/substep.js index d79253e..b94f618 100644 --- a/src/plugins/substep/substep.js +++ b/src/plugins/substep/substep.js @@ -104,6 +104,11 @@ currentSubstepOrder = el.dataset.substepOrder; el.classList.add( "substep-visible" ); el.classList.add( "substep-active" ); + if ( currentSubstepOrder === undefined ) { + + // Stop after one substep as default order + break; + } } return el; @@ -136,6 +141,7 @@ // Continue if there is another substep with the same substepOrder if ( current > 0 && + visible[ current ].dataset.substepOrder !== undefined && visible[ current - 1 ].dataset.substepOrder === visible[ current ].dataset.substepOrder ) { visible.pop();