From 6620c671cdf0c1bbae27a064ee64fbe8b7c9e4d7 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Wed, 12 Feb 2020 16:46:10 -0500 Subject: [PATCH] Fix progressive reveal and Topics with special characters not loading (#330) * Make sure to update the js model that the section was skipped * allow for non ascii chars to be used in hash * update news * Use decodeURIComponent() over decodeURI() when working with just the hash --- NEWS.md | 6 +++++- .../templates/tutorial/resources/tutorial-format.js | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index d46a52a14..6f779c0b9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -15,10 +15,14 @@ learnr 0.10.0.9000 (unreleased) * Fixed a bug where broken exercise code created non-"length-one character vector". ([#311](https://github.com/rstudio/learnr/pull/311)) -* Fixed extra parameter documentation bug. ([#323](https://github.com/rstudio/learnr/pull/323)) +* Fixed extra parameter documentation bug for CRAN. ([#323](https://github.com/rstudio/learnr/pull/323)) * Fixed video initialization error caused by a jQuery version increase in Shiny. ([#326](https://github.com/rstudio/learnr/pull/#326)) +* Fixed progressive reveal bug where the next section would not be displayed unless refreshed. ([#330](https://github.com/rstudio/learnr/pull/330)) + +* Fixed a bug where topics would not be loaded if they contained non-ascii characters. ([#330](https://github.com/rstudio/learnr/pull/330)) + learnr 0.10.0 =========== diff --git a/inst/rmarkdown/templates/tutorial/resources/tutorial-format.js b/inst/rmarkdown/templates/tutorial/resources/tutorial-format.js index 33b43b6bf..2088c7fe4 100644 --- a/inst/rmarkdown/templates/tutorial/resources/tutorial-format.js +++ b/inst/rmarkdown/templates/tutorial/resources/tutorial-format.js @@ -156,6 +156,9 @@ $(document).ready(function() { else { scrollLastSectionToView = true; } + // update UI + sectionSkipped([section.jqElement]); + // notify server tutorial.skipSection(sectionId); } } @@ -317,7 +320,7 @@ $(document).ready(function() { function handleLocationHash() { function findTopicIndexFromHash() { - var hash = window.location.hash; + var hash = window.decodeURIComponent(window.location.hash); var topicIndex = 0; if (hash.length > 0) { $.each(topics, function( ti, t) {