support including plugins via <script> instead of dependencies

This commit is contained in:
Hakim El Hattab 2020-04-16 15:45:25 +02:00
parent 34458a988a
commit 7b151c2320
10 changed files with 6 additions and 26 deletions

2
dist/reveal.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -45,7 +45,7 @@ window.Reveal.initialize = options => {
* queuing up early API calls and invoking all of them * queuing up early API calls and invoking all of them
* when Reveal.initialize is called. * when Reveal.initialize is called.
*/ */
[ 'on', 'off', 'addEventListener', 'removeEventListener' ].forEach( method => { [ 'on', 'off', 'addEventListener', 'removeEventListener', 'registerPlugin' ].forEach( method => {
window.Reveal[method] = ( ...args ) => { window.Reveal[method] = ( ...args ) => {
enqueuedAPICalls.push( deck => deck[method].call( null, ...args ) ); enqueuedAPICalls.push( deck => deck[method].call( null, ...args ) );
} }

View file

@ -34,7 +34,7 @@ import {
/** /**
* reveal.js * reveal.js
* http://revealjs.com * https://revealjs.com
* MIT licensed * MIT licensed
* *
* Copyright (C) 2020 Hakim El Hattab, https://hakim.se * Copyright (C) 2020 Hakim El Hattab, https://hakim.se

View file

@ -163,20 +163,15 @@
</div> </div>
<script src="../../dist/reveal.min.js"></script> <script src="../../dist/reveal.min.js"></script>
<script> <script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({ Reveal.initialize({
center: true, center: true,
hash: true, hash: true,
dependencies: [ dependencies: [
{ src: '../../plugin/highlight/highlight.js', async: true } { src: '../../dist/plugin/highlight.js', async: true }
] ]
}); });
</script> </script>
</body> </body>

View file

@ -30,11 +30,8 @@
</div> </div>
<script src="../../dist/reveal.min.js"></script> <script src="../../dist/reveal.min.js"></script>
<script> <script>
Reveal.initialize(); Reveal.initialize();
</script> </script>
</body> </body>

View file

@ -40,13 +40,10 @@
</div> </div>
<script src="../../dist/reveal.min.js"></script> <script src="../../dist/reveal.min.js"></script>
<script> <script>
Reveal.initialize({ Reveal.initialize({
transition: 'linear' transition: 'linear'
}); });
</script> </script>
</body> </body>

View file

@ -176,9 +176,7 @@
</div> </div>
<script src="../../dist/reveal.min.js"></script> <script src="../../dist/reveal.min.js"></script>
<script> <script>
Reveal.initialize({ Reveal.initialize({
history: true, history: true,
transition: 'linear', transition: 'linear',
@ -198,7 +196,6 @@
{ src: '../../dist/plugin/math.js', async: true } { src: '../../dist/plugin/math.js', async: true }
] ]
}); });
</script> </script>
</body> </body>

View file

@ -40,10 +40,9 @@
</div> </div>
</div> </div>
<script src="../../dist/reveal.min.js"></script>
<script type="module"> <script type="module">
import Reveal from '../../js/reveal.js';
import Markdown from '../../plugin/markdown/markdown.js'; import Markdown from '../../plugin/markdown/markdown.js';
let r1 = new Reveal( document.querySelector( '.deck1' ), { let r1 = new Reveal( document.querySelector( '.deck1' ), {
@ -55,7 +54,7 @@
let r2 = new Reveal( document.querySelector( '.deck2' ), { let r2 = new Reveal( document.querySelector( '.deck2' ), {
embedded: true, embedded: true,
keyboard: false, keyboard: false,
dependencies: [{plugin: Markdown}] dependencies: [ Markdown ]
} ); } );
r2.initialize(); r2.initialize();

View file

@ -123,14 +123,12 @@
</div> </div>
<script src="../../dist/reveal.min.js"></script> <script src="../../dist/reveal.min.js"></script>
<script> <script>
// Full list of configuration options available here: // Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration // https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({ Reveal.initialize({
center: true, center: true,
// rtl: true,
transition: 'linear', transition: 'linear',
// transitionSpeed: 'slow', // transitionSpeed: 'slow',

View file

@ -82,9 +82,7 @@
</div> </div>
<script src="../../dist/reveal.min.js"></script> <script src="../../dist/reveal.min.js"></script>
<script> <script>
Reveal.initialize({ Reveal.initialize({
center: true, center: true,
history: true, history: true,
@ -93,7 +91,6 @@
// transitionSpeed: 'slow', // transitionSpeed: 'slow',
// backgroundTransition: 'slide' // backgroundTransition: 'slide'
}); });
</script> </script>
</body> </body>