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">
|
||||
|
||||
import Reveal from '/dist/reveal.js';
|
||||
import zoom from '/plugin/zoom/zoom.js';
|
||||
import notes from '/plugin/notes/notes.js';
|
||||
import search from '/plugin/search/search.js';
|
||||
import markdown from '/plugin/markdown/markdown.js';
|
||||
import highlight from '/plugin/highlight/highlight.js';
|
||||
import Zoom from '/plugin/zoom/zoom.js';
|
||||
import Notes from '/plugin/notes/notes.js';
|
||||
import Search from '/plugin/search/search.js';
|
||||
import Markdown from '/plugin/markdown/markdown.js';
|
||||
import Highlight from '/plugin/highlight/highlight.js';
|
||||
|
||||
// More info https://github.com/hakimel/reveal.js#configuration
|
||||
Reveal.initialize({
|
||||
@ -428,8 +428,8 @@ Reveal.on( 'customevent', function() {
|
||||
|
||||
transition: 'slide', // none/fade/slide/convex/concave/zoom
|
||||
|
||||
// More info https://github.com/hakimel/reveal.js#dependencies
|
||||
plugins: [ zoom(), notes(), search(), markdown(), highlight() ]
|
||||
// More info https://github.com/hakimel/reveal.js#plugins
|
||||
plugins: [ Zoom, Notes, Search, Markdown, Highlight ]
|
||||
});
|
||||
|
||||
</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({
|
||||
exclude: 'node_modules/**',
|
||||
compact: false,
|
||||
presets: [
|
||||
[
|
||||
presets: [[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
corejs: 3,
|
||||
useBuiltIns: 'entry',
|
||||
modules: false
|
||||
}
|
||||
]
|
||||
]
|
||||
]]
|
||||
}),
|
||||
resolve(),
|
||||
terser()
|
||||
|
@ -28,10 +28,10 @@
|
||||
<script>
|
||||
// More info about config & dependencies:
|
||||
// - https://github.com/hakimel/reveal.js#configuration
|
||||
// - https://github.com/hakimel/reveal.js#dependencies
|
||||
// - https://github.com/hakimel/reveal.js#plugins
|
||||
Reveal.initialize({
|
||||
hash: true,
|
||||
plugins: [ RevealMarkdown(), RevealHighlight(), RevealNotes() ]
|
||||
plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ]
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
@ -183,6 +183,11 @@ export default class Plugins {
|
||||
plugin = arguments[1];
|
||||
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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user