1
0
mirror of https://github.com/hakimel/reveal.js.git synced 2025-08-11 00:55:01 +02:00

fix empty slide bug when all slides in a stack are hidden via data-visibility

This commit is contained in:
Hakim El Hattab
2023-09-15 13:48:26 +02:00
parent a4b7f9dff7
commit 07a6cf1249
5 changed files with 16 additions and 5 deletions

2
dist/reveal.esm.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/reveal.js vendored

File diff suppressed because one or more lines are too long

2
dist/reveal.js.map vendored

File diff suppressed because one or more lines are too long

View File

@@ -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();
}
} );
}