Skip to content

Commit

Permalink
feat: Add ESModule style script
Browse files Browse the repository at this point in the history
  • Loading branch information
attakei committed Oct 17, 2024
1 parent 21fda78 commit 1273520
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"version": "0.0.0",
"description": "Build tool only",
"scripts": {
"build:umd": "cd src/atsphinx/revealjs_rtd/static/atsphinx-revealjs-rtd && rollup --compact -n RevealRTD -f umd -o rtd.js plugin.js"
"build:umd": "cd src/atsphinx/revealjs_rtd/static/atsphinx-revealjs-rtd && rollup --compact -n RevealRTD -f umd -o rtd.js plugin.js",
"build:esm": "cd src/atsphinx/revealjs_rtd/static/atsphinx-revealjs-rtd && rollup --compact -f es -o rtd.esm.js plugin.js"
},
"keywords": [],
"author": "",
Expand Down
14 changes: 14 additions & 0 deletions src/atsphinx/revealjs_rtd/static/atsphinx-revealjs-rtd/rtd.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const Plugin = {
id: 'rtd',
init(reveal) {
const deck = reveal;
deck.addKeyBinding({keyCode: 68, key: 'D', description: 'Toggle RTD widget'}, function() {
console.debug("Press toggle-key of RTD.");
const flyout = document.querySelector("readthedocs-flyout");
if (!flyout) return;
flyout.style.display = flyout.style.display ? "" : "none";
});
}
};

var plugin = () => Plugin;export{plugin as default};

0 comments on commit 1273520

Please sign in to comment.