Skip to content

Commit

Permalink
fix empty slide bug when all slides in a stack are hidden via data-vi…
Browse files Browse the repository at this point in the history
…sibility
  • Loading branch information
hakimel committed Sep 15, 2023
1 parent a4b7f9d commit 07a6cf1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/reveal.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.esm.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.js.map

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,18 @@ export default function( revealElement, options ) {

if( !config.showHiddenSlides ) {
Util.queryAll( dom.wrapper, 'section[data-visibility="hidden"]' ).forEach( slide => {
slide.parentNode.removeChild( slide );
const parent = slide.parentNode;

// If this slide is part of a stack and that stack will be
// empty after removing the hidden slide, remove the entire
// stack
if( parent.childElementCount === 1 && /section/i.test( parent.nodeName ) ) {
parent.remove();
}
else {
slide.remove();
}

} );
}

Expand Down

0 comments on commit 07a6cf1

Please sign in to comment.