Merge pull request #727 from hedgedoc/fix/slideOptionsSanitation

This commit is contained in:
David Mehren 2021-01-14 21:57:07 +01:00 committed by GitHub
commit 2b8aac289a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 2 deletions

View file

@ -103,7 +103,7 @@ import { md } from './extra'
// prevent script end tags in the content from interfering
// with parsing
content = content.replace(/<\/script>/g, SCRIPT_END_PLACEHOLDER)
content = content.replace(/<\/script>/gi, SCRIPT_END_PLACEHOLDER)
return '<script type="text/template">' + content + '</script>'
}

View file

@ -72,7 +72,57 @@ const defaultOptions = {
// options from yaml meta
const meta = JSON.parse($('#meta').text())
var options = 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
} || {}
const view = $('.reveal')