allow reveal.js instances to be created with only options
This commit is contained in:
parent
a55cd813be
commit
d03fc04f61
|
@ -420,7 +420,7 @@ Reveal.on( 'customevent', function() {
|
||||||
import Highlight from '/plugin/highlight/highlight.js';
|
import Highlight from '/plugin/highlight/highlight.js';
|
||||||
|
|
||||||
// More info https://github.com/hakimel/reveal.js#configuration
|
// More info https://github.com/hakimel/reveal.js#configuration
|
||||||
let deck = new Reveal( document.querySelector( '.reveal' ), {
|
let deck = new Reveal({
|
||||||
controls: true,
|
controls: true,
|
||||||
progress: true,
|
progress: true,
|
||||||
center: true,
|
center: true,
|
||||||
|
|
File diff suppressed because one or more lines are too long
11
js/reveal.js
11
js/reveal.js
|
@ -41,6 +41,12 @@ import {
|
||||||
*/
|
*/
|
||||||
export default function( revealElement, options ) {
|
export default function( revealElement, options ) {
|
||||||
|
|
||||||
|
// Support initialization with only options
|
||||||
|
if( arguments.length === 1 ) {
|
||||||
|
options = arguments[0];
|
||||||
|
revealElement = document.querySelector( '.reveal' );
|
||||||
|
}
|
||||||
|
|
||||||
const Reveal = {};
|
const Reveal = {};
|
||||||
|
|
||||||
// The reveal.js version
|
// The reveal.js version
|
||||||
|
@ -117,11 +123,6 @@ export default function( revealElement, options ) {
|
||||||
*/
|
*/
|
||||||
function initialize() {
|
function initialize() {
|
||||||
|
|
||||||
if( !revealElement ) {
|
|
||||||
console.warn( 'reveal.js can not initialize without a valid .reveal element.' );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cache references to key DOM elements
|
// Cache references to key DOM elements
|
||||||
dom.wrapper = revealElement;
|
dom.wrapper = revealElement;
|
||||||
dom.slides = revealElement.querySelector( '.slides' );
|
dom.slides = revealElement.querySelector( '.slides' );
|
||||||
|
|
Loading…
Reference in New Issue