plugins can be direct references or factory functions
This commit is contained in:
parent
c1b2e415db
commit
210fbb7646
14
demo.html
14
demo.html
|
@ -413,11 +413,11 @@ Reveal.on( 'customevent', function() {
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
||||||
import Reveal from '/dist/reveal.js';
|
import Reveal from '/dist/reveal.js';
|
||||||
import zoom from '/plugin/zoom/zoom.js';
|
import Zoom from '/plugin/zoom/zoom.js';
|
||||||
import notes from '/plugin/notes/notes.js';
|
import Notes from '/plugin/notes/notes.js';
|
||||||
import search from '/plugin/search/search.js';
|
import Search from '/plugin/search/search.js';
|
||||||
import markdown from '/plugin/markdown/markdown.js';
|
import Markdown from '/plugin/markdown/markdown.js';
|
||||||
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
|
||||||
Reveal.initialize({
|
Reveal.initialize({
|
||||||
|
@ -428,8 +428,8 @@ Reveal.on( 'customevent', function() {
|
||||||
|
|
||||||
transition: 'slide', // none/fade/slide/convex/concave/zoom
|
transition: 'slide', // none/fade/slide/convex/concave/zoom
|
||||||
|
|
||||||
// More info https://github.com/hakimel/reveal.js#dependencies
|
// More info https://github.com/hakimel/reveal.js#plugins
|
||||||
plugins: [ zoom(), notes(), search(), markdown(), highlight() ]
|
plugins: [ Zoom, Notes, Search, Markdown, Highlight ]
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
2
dist/reveal.es5.js
vendored
2
dist/reveal.es5.js
vendored
File diff suppressed because one or more lines are too long
2
dist/reveal.es5.js.map
vendored
2
dist/reveal.es5.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/reveal.js
vendored
2
dist/reveal.js
vendored
File diff suppressed because one or more lines are too long
2
dist/reveal.js.map
vendored
2
dist/reveal.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -39,16 +39,14 @@ const rollupConfig = {
|
||||||
babel({
|
babel({
|
||||||
exclude: 'node_modules/**',
|
exclude: 'node_modules/**',
|
||||||
compact: false,
|
compact: false,
|
||||||
presets: [
|
presets: [[
|
||||||
[
|
|
||||||
'@babel/preset-env',
|
'@babel/preset-env',
|
||||||
{
|
{
|
||||||
corejs: 3,
|
corejs: 3,
|
||||||
useBuiltIns: 'entry',
|
useBuiltIns: 'entry',
|
||||||
modules: false
|
modules: false
|
||||||
}
|
}
|
||||||
]
|
]]
|
||||||
]
|
|
||||||
}),
|
}),
|
||||||
resolve(),
|
resolve(),
|
||||||
terser()
|
terser()
|
||||||
|
|
|
@ -28,10 +28,10 @@
|
||||||
<script>
|
<script>
|
||||||
// More info about config & dependencies:
|
// More info about config & dependencies:
|
||||||
// - https://github.com/hakimel/reveal.js#configuration
|
// - https://github.com/hakimel/reveal.js#configuration
|
||||||
// - https://github.com/hakimel/reveal.js#dependencies
|
// - https://github.com/hakimel/reveal.js#plugins
|
||||||
Reveal.initialize({
|
Reveal.initialize({
|
||||||
hash: true,
|
hash: true,
|
||||||
plugins: [ RevealMarkdown(), RevealHighlight(), RevealNotes() ]
|
plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ]
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -183,6 +183,11 @@ export default class Plugins {
|
||||||
plugin = arguments[1];
|
plugin = arguments[1];
|
||||||
plugin.id = arguments[0];
|
plugin.id = arguments[0];
|
||||||
}
|
}
|
||||||
|
// Plugin can optionally be a function which we call
|
||||||
|
// to create an instance of the plugin
|
||||||
|
else if( typeof plugin === 'function' ) {
|
||||||
|
plugin = plugin();
|
||||||
|
}
|
||||||
|
|
||||||
let id = plugin.id;
|
let id = plugin.id;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user