patarapolw / reveal-editor

Live Reveal.js editor, with global styles/scripts, Markdown and HyperPug. Also, Node-installable.
https://patarapolw.github.io/reveal-editor
MIT License
8 stars 0 forks source link

Support for plugins #1

Open Jean-Fischer opened 4 years ago

Jean-Fischer commented 4 years ago

Hi ! Nice work ! I would like to add 3rd party RevealJs plugins to the editor. Is this possible? What would be the best approach?

In RevealJs I would normally just include these plugins in index.html within the Reveal.initialize block:

Reveal.initialize({
                         // ...
        dependencies: [
                               // ...
            { src: 'plugin/tagcloud/tagcloud.js', async: true },
            { src: 'plugin/badges/badges.js'},
                                // OTHER PLUGINS GO HERE
        ],
        badges: { /* SAMPLE PLUGIN CONFIG... */ }
    });

Do you plan to provide a similar way for including plugins on a per-project basis?

patarapolw commented 4 years ago

You can also try Reveal.config(extraConfig), if in editor.

You can also directly dynamically insert script tag into document.body

$body.append($("<script>").attr({
  class: "reveal-js",
  type: "text/javascript",
  src: this.revealOptions.cdn + js
}));

Or

document.body.append(Object.assign(document.createElement("script"), {
   src
}));

Personally, I only need custom markdown and changeable theme, though.