Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Andrew Seales
Kubernetes Presentation
Commits
4f280f77
Commit
4f280f77
authored
Mar 12, 2020
by
Hakim El Hattab
Browse files
update logic for disabling fragments via config option
parent
bff9bfb1
Changes
2
Hide whitespace changes
Inline
Side-by-side
js/controllers/fragments.js
View file @
4f280f77
...
...
@@ -14,10 +14,10 @@ export default class Fragments {
}
/**
*
Shows all
fragments
in the presentation. Used when
*
fragments are disabled presentation-wide
.
*
If
fragments
are disabled in the deck, they should all be
*
visible rather than stepped through
.
*/
showAll
()
{
disable
()
{
toArray
(
this
.
Reveal
.
getSlidesElement
().
querySelectorAll
(
'
.fragment
'
)
).
forEach
(
element
=>
{
element
.
classList
.
add
(
'
visible
'
);
...
...
@@ -26,6 +26,19 @@ export default class Fragments {
}
/**
* Reverse of #disable(). Only called if fragments have
* previously been disabled.
*/
enable
()
{
toArray
(
this
.
Reveal
.
getSlidesElement
().
querySelectorAll
(
'
.fragment
'
)
).
forEach
(
element
=>
{
element
.
classList
.
remove
(
'
visible
'
);
element
.
classList
.
remove
(
'
current-fragment
'
);
}
);
}
/**
* Returns an object describing the available fragment
* directions.
...
...
js/reveal.js
View file @
4f280f77
...
...
@@ -787,7 +787,7 @@ export default function( revealElement, options ) {
*/
function
configure
(
options
)
{
const
old
Transition
=
config
.
transition
;
const
old
Config
=
{
...
config
}
// New config options may be passed when this method
// is invoked through the API after initialization
...
...
@@ -800,7 +800,7 @@ export default function( revealElement, options ) {
const
numberOfSlides
=
dom
.
wrapper
.
querySelectorAll
(
SLIDES_SELECTOR
).
length
;
// The transition is added as a class on the .reveal element
dom
.
wrapper
.
classList
.
remove
(
old
T
ransition
);
dom
.
wrapper
.
classList
.
remove
(
old
Config
.
t
ransition
);
dom
.
wrapper
.
classList
.
add
(
config
.
transition
);
dom
.
wrapper
.
setAttribute
(
'
data-transition-speed
'
,
config
.
transitionSpeed
);
...
...
@@ -889,9 +889,12 @@ export default function( revealElement, options ) {
autoSlidePaused
=
false
;
}
//
When fragments are turned off they should be visible
//
Update the state of our fragments
if
(
config
.
fragments
===
false
)
{
fragments
.
showAll
();
fragments
.
disable
();
}
else
if
(
oldConfig
.
fragments
===
false
)
{
fragments
.
enable
();
}
// Add the navigation mode to the DOM so we can adjust styling
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment