Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ioslides): Shiny-specific initialization #2516

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: rmarkdown
Title: Dynamic Documents for R
Version: 2.24.2
Version: 2.24.3
Authors@R: c(
person("JJ", "Allaire", , "jj@posit.co", role = "aut"),
person("Yihui", "Xie", , "xie@yihui.name", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-0645-5666")),
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ rmarkdown 2.25

- Fixed a bug that filenames beginning with `-` cause incorrect invocation of Pandoc (thanks, @mbaynton, #2503).

- Documented how to merge `output_format_dependency()` to the output format (thanks, @atusy, #2508)
- Documented how to merge `output_format_dependency()` to the output format (thanks, @atusy, #2508).

- `ioslides_presentation()` now correctly works with new **shiny** 1.7.5 (thanks, @nicolasgaraycoa, #2514, @gadenbuie, #2516).

rmarkdown 2.24
================================================================================
Expand Down
5 changes: 5 additions & 0 deletions inst/rmd/ioslides/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>
window.jQuery(e.target).trigger('shown');
});
}
if (window.Shiny) {
// Initialize slides when this script appears on the page, since it
// indicates that the <slides> markup has been fully loaded.
window.loadDeck();
}
})();
</script>

Expand Down
25 changes: 14 additions & 11 deletions inst/rmd/ioslides/ioslides-13.5.1/js/slide-deck.js
Original file line number Diff line number Diff line change
Expand Up @@ -793,17 +793,20 @@ var loadDeck = function(event) {
});
};

if (document.readyState !== "loading" &&
document.querySelector('slides') === null) {
// if the document is done loading but our element hasn't yet appeared, defer
// loading of the deck
window.setTimeout(function() {
loadDeck(null);
}, 0);
} else {
// still loading the DOM, so wait until it's finished
document.addEventListener("DOMContentLoaded", loadDeck);
if (!window.Shiny) {
// If Shiny is loaded, the slide deck is initialized in ioslides template

if (document.readyState !== "loading" &&
document.querySelector('slides') === null) {
// if the document is done loading but our element hasn't yet appeared, defer
// loading of the deck
window.setTimeout(function() {
loadDeck(null);
}, 0);
cderv marked this conversation as resolved.
Show resolved Hide resolved
} else {
// still loading the DOM, so wait until it's finished
document.addEventListener("DOMContentLoaded", loadDeck);
}
}