@farberg/reveal-template 1.1.32 → 1.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farberg/reveal-template",
3
- "version": "1.1.32",
3
+ "version": "1.1.33",
4
4
  "homepage": "https://github.com/pfisterer/reveal-template",
5
5
  "description": "Reveal.js template for Dennis' lectures",
6
6
  "main": "index.js",
@@ -2,7 +2,7 @@
2
2
  Create a zip from existing files for download and display a tree of files
3
3
 
4
4
  Attributes on <pre class="dirtree">:
5
- data-zipname="archive.zip" — name of the downloaded zip (default: download.zip)
5
+ data-zipname="archive.zip" — name of the downloaded zip; omit to hide the download button
6
6
  data-line-height="1.6" — line spacing (default: 1.85)
7
7
  data-width="auto" — container width, e.g. "400px", "60%", "auto" (default: auto)
8
8
 
@@ -771,7 +771,7 @@ const dirTreeFactory = ({ zip, strToU8 }) => ({
771
771
  injectStyles();
772
772
 
773
773
  for (const el of deck.getRevealElement().querySelectorAll('pre.dirtree')) {
774
- const zipName = el.getAttribute('data-zipname') || 'download.zip';
774
+ const zipName = el.getAttribute('data-zipname');
775
775
  const lineHeight = el.getAttribute('data-line-height') || '1.85';
776
776
  const width = el.getAttribute('data-width') || 'auto';
777
777
 
@@ -789,12 +789,15 @@ const dirTreeFactory = ({ zip, strToU8 }) => ({
789
789
  container.style.lineHeight = lineHeight;
790
790
  if (width !== 'auto') container.style.width = width;
791
791
 
792
- const btn = document.createElement('a');
793
- btn.classList.add('dirtree-download-btn');
794
- btn.textContent = '' + zipName;
795
- btn.href = '#zip/' + zipName;
796
- btn.addEventListener('click', e => { e.preventDefault(); download(files, zipName); });
797
- container.appendChild(btn);
792
+ // Only show the download button when a zip name is configured.
793
+ if (zipName) {
794
+ const btn = document.createElement('a');
795
+ btn.classList.add('dirtree-download-btn');
796
+ btn.textContent = '⬇ ' + zipName;
797
+ btn.href = '#zip/' + zipName;
798
+ btn.addEventListener('click', e => { e.preventDefault(); download(files, zipName); });
799
+ container.appendChild(btn);
800
+ }
798
801
 
799
802
  const ul = document.createElement('ul');
800
803
  ul.classList.add('dirtree');