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
* when Reveal.initialize is called.
*/
[ 'on', 'off', 'addEventListener', 'removeEventListener' ].forEach( method => {
[ 'on', 'off', 'addEventListener', 'removeEventListener', 'registerPlugin' ].forEach( method => {
window.Reveal[method] = ( ...args ) => {
enqueuedAPICalls.push( deck => deck[method].call( null, ...args ) );
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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