From 8984c087dc5d39e9fa8f137f1c3b8aebaba7450f Mon Sep 17 00:00:00 2001 From: "Stefan@AWG" Date: Thu, 18 Jun 2020 19:17:30 +0200 Subject: [PATCH 1/7] fix(tutorial.js): switch handling of step incrementation This fix increments the step number of the nextStepButton to the next step number, so the loadTutorialStep() function just has to call this step number without incrementation. --- js/mei-tutorials.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/js/mei-tutorials.js b/js/mei-tutorials.js index 6d320961..648cec52 100644 --- a/js/mei-tutorials.js +++ b/js/mei-tutorials.js @@ -111,16 +111,19 @@ function setupTutorial(data) { a.innerHTML = text; li.appendChild(a); stepBox.appendChild(li); - + + //initial step + var stepNum = 0 ; + //start with the first step of the tutorial - loadTutorialStep(data,0); + loadTutorialStep(data,stepNum); //add listener to allow going to the next step document.getElementById('nextStepButton').addEventListener('click',(e) => { var stepNum = parseInt(e.target.getAttribute('data-stepnum')); // load next step - loadTutorialStep(data,stepNum + 1); + loadTutorialStep(data, stepNum); }); } @@ -152,7 +155,7 @@ function loadTutorialStep(data, stepNum) { document.getElementById('fullFileTitle').innerHTML = step.xmlFile; //activate current item - activateStepListItem(data,stepNum); + activateStepListItem(data, stepNum); //decide if XML editor is needed on this page, and if it needs to be prefilled var requiresEditor = (typeof step.xmlFile !== 'undefined' && step.xmlFile !== '') && typeof step.xpaths !== 'undefined' && step.xpaths.length > 0; @@ -163,7 +166,7 @@ function loadTutorialStep(data, stepNum) { var nextStepButton = document.getElementById('nextStepButton'); //update nextStepButton to allow proceeding. listener is set in setupTutorial() - nextStepButton.setAttribute('data-stepnum',stepNum); + nextStepButton.setAttribute('data-next-stepnum',stepNum + 1); //show editor only when needed, allow to proceed without interaction if(!requiresEditor) { From 749ab5f6750acb72cb5becc3d1ad89d852c8f860 Mon Sep 17 00:00:00 2001 From: "Stefan@AWG" Date: Thu, 18 Jun 2020 19:18:34 +0200 Subject: [PATCH 2/7] doc(tutorials.html): add some doc for the editor div --- _layouts/tutorials.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_layouts/tutorials.html b/_layouts/tutorials.html index 6aa0d8fe..8c21431b 100644 --- a/_layouts/tutorials.html +++ b/_layouts/tutorials.html @@ -26,7 +26,9 @@

MEI Editor

-
+
+ +