mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
Fix wrong acces to slide options
If the slide options in the frontmatter are empty or not present, then slideOptions object in the parsed JSON is undefined. This triggers an exception when the sanitized slide options object is built. Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
78a732abe6
commit
9f59a73049
1 changed files with 50 additions and 49 deletions
|
@ -72,56 +72,57 @@ const defaultOptions = {
|
|||
|
||||
// options from yaml meta
|
||||
const meta = JSON.parse($('#meta').text())
|
||||
const metaSlideOptions = !!meta && !!meta.slideOptions ? meta.slideOptions : {}
|
||||
var options = {
|
||||
autoPlayMedia: meta.slideOptions.autoPlayMedia,
|
||||
autoSlide: meta.slideOptions.autoSlide,
|
||||
autoSlideStoppable: meta.slideOptions.autoSlideStoppable,
|
||||
backgroundTransition: meta.slideOptions.backgroundTransition,
|
||||
center: meta.slideOptions.center,
|
||||
controls: meta.slideOptions.controls,
|
||||
controlsBackArrows: meta.slideOptions.controlsBackArrows,
|
||||
controlsLayout: meta.slideOptions.controlsLayout,
|
||||
controlsTutorial: meta.slideOptions.controlsTutorial,
|
||||
defaultTiming: meta.slideOptions.defaultTiming,
|
||||
display: meta.slideOptions.display,
|
||||
embedded: meta.slideOptions.embedded,
|
||||
fragmentInURL: meta.slideOptions.fragmentInURL,
|
||||
fragments: meta.slideOptions.fragments,
|
||||
hash: meta.slideOptions.hash,
|
||||
height: meta.slideOptions.height,
|
||||
help: meta.slideOptions.help,
|
||||
hideAddressBar: meta.slideOptions.hideAddressBar,
|
||||
hideCursorTime: meta.slideOptions.hideCursorTime,
|
||||
hideInactiveCursor: meta.slideOptions.hideInactiveCursor,
|
||||
history: meta.slideOptions.history,
|
||||
keyboard: meta.slideOptions.keyboard,
|
||||
loop: meta.slideOptions.loop,
|
||||
margin: meta.slideOptions.margin,
|
||||
maxScale: meta.slideOptions.maxScale,
|
||||
minScale: meta.slideOptions.minScale,
|
||||
minimumTimePerSlide: meta.slideOptions.minimumTimePerSlide,
|
||||
mobileViewDistance: meta.slideOptions.mobileViewDistance,
|
||||
mouseWheel: meta.slideOptions.mouseWheel,
|
||||
navigationMode: meta.slideOptions.navigationMode,
|
||||
overview: meta.slideOptions.overview,
|
||||
parallaxBackgroundHorizontal: meta.slideOptions.parallaxBackgroundHorizontal,
|
||||
parallaxBackgroundImage: meta.slideOptions.parallaxBackgroundImage,
|
||||
parallaxBackgroundSize: meta.slideOptions.parallaxBackgroundSize,
|
||||
parallaxBackgroundVertical: meta.slideOptions.parallaxBackgroundVertical,
|
||||
preloadIframes: meta.slideOptions.preloadIframes,
|
||||
previewLinks: meta.slideOptions.previewLinks,
|
||||
progress: meta.slideOptions.progress,
|
||||
rtl: meta.slideOptions.rtl,
|
||||
showNotes: meta.slideOptions.showNotes,
|
||||
shuffle: meta.slideOptions.shuffle,
|
||||
slideNumber: meta.slideOptions.slideNumber,
|
||||
theme: meta.slideOptions.theme,
|
||||
totalTime: meta.slideOptions.totalTime,
|
||||
touch: meta.slideOptions.touch,
|
||||
transition: meta.slideOptions.transition,
|
||||
transitionSpeed: meta.slideOptions.transitionSpeed,
|
||||
viewDistance: meta.slideOptions.viewDistance,
|
||||
width: meta.slideOptions.width
|
||||
autoPlayMedia: metaSlideOptions.autoPlayMedia,
|
||||
autoSlide: metaSlideOptions.autoSlide,
|
||||
autoSlideStoppable: metaSlideOptions.autoSlideStoppable,
|
||||
backgroundTransition: metaSlideOptions.backgroundTransition,
|
||||
center: metaSlideOptions.center,
|
||||
controls: metaSlideOptions.controls,
|
||||
controlsBackArrows: metaSlideOptions.controlsBackArrows,
|
||||
controlsLayout: metaSlideOptions.controlsLayout,
|
||||
controlsTutorial: metaSlideOptions.controlsTutorial,
|
||||
defaultTiming: metaSlideOptions.defaultTiming,
|
||||
display: metaSlideOptions.display,
|
||||
embedded: metaSlideOptions.embedded,
|
||||
fragmentInURL: metaSlideOptions.fragmentInURL,
|
||||
fragments: metaSlideOptions.fragments,
|
||||
hash: metaSlideOptions.hash,
|
||||
height: metaSlideOptions.height,
|
||||
help: metaSlideOptions.help,
|
||||
hideAddressBar: metaSlideOptions.hideAddressBar,
|
||||
hideCursorTime: metaSlideOptions.hideCursorTime,
|
||||
hideInactiveCursor: metaSlideOptions.hideInactiveCursor,
|
||||
history: metaSlideOptions.history,
|
||||
keyboard: metaSlideOptions.keyboard,
|
||||
loop: metaSlideOptions.loop,
|
||||
margin: metaSlideOptions.margin,
|
||||
maxScale: metaSlideOptions.maxScale,
|
||||
minScale: metaSlideOptions.minScale,
|
||||
minimumTimePerSlide: metaSlideOptions.minimumTimePerSlide,
|
||||
mobileViewDistance: metaSlideOptions.mobileViewDistance,
|
||||
mouseWheel: metaSlideOptions.mouseWheel,
|
||||
navigationMode: metaSlideOptions.navigationMode,
|
||||
overview: metaSlideOptions.overview,
|
||||
parallaxBackgroundHorizontal: metaSlideOptions.parallaxBackgroundHorizontal,
|
||||
parallaxBackgroundImage: metaSlideOptions.parallaxBackgroundImage,
|
||||
parallaxBackgroundSize: metaSlideOptions.parallaxBackgroundSize,
|
||||
parallaxBackgroundVertical: metaSlideOptions.parallaxBackgroundVertical,
|
||||
preloadIframes: metaSlideOptions.preloadIframes,
|
||||
previewLinks: metaSlideOptions.previewLinks,
|
||||
progress: metaSlideOptions.progress,
|
||||
rtl: metaSlideOptions.rtl,
|
||||
showNotes: metaSlideOptions.showNotes,
|
||||
shuffle: metaSlideOptions.shuffle,
|
||||
slideNumber: metaSlideOptions.slideNumber,
|
||||
theme: metaSlideOptions.theme,
|
||||
totalTime: metaSlideOptions.totalTime,
|
||||
touch: metaSlideOptions.touch,
|
||||
transition: metaSlideOptions.transition,
|
||||
transitionSpeed: metaSlideOptions.transitionSpeed,
|
||||
viewDistance: metaSlideOptions.viewDistance,
|
||||
width: metaSlideOptions.width
|
||||
} || {}
|
||||
|
||||
for (const key in options) {
|
||||
|
|
Loading…
Reference in a new issue