Add download button for unsupported file types

This commit is contained in:
Starbeamrainbowlabs 2019-06-01 21:37:35 +01:00
parent c6db576980
commit 7df4c51834
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
4 changed files with 9 additions and 2 deletions

View File

@ -27,6 +27,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- Added new `minify_pageindex` setting, which defaults to `true` and causes the page index to be minified when saved. Improves performance slightly (especially on larger wikis as the page index grows), but makes debugging and ninja-edits more awkward. - Added new `minify_pageindex` setting, which defaults to `true` and causes the page index to be minified when saved. Improves performance slightly (especially on larger wikis as the page index grows), but makes debugging and ninja-edits more awkward.
- [Module API] Added new `save_pageindex()` function which respects the above setting. - [Module API] Added new `save_pageindex()` function which respects the above setting.
- Added PDF preview using your browser's default PDF viewer! - Added PDF preview using your browser's default PDF viewer!
- Added download button for unsupported file types
### Changed ### Changed
- Core sharding: split `core.php` into multiple files - Core sharding: split `core.php` into multiple files

View File

@ -155,7 +155,7 @@
"version": "0.5.17", "version": "0.5.17",
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File\/' prefix.", "description": "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File\/' prefix.",
"lastupdate": 1559416947, "lastupdate": 1559420955,
"optional": false, "optional": false,
"extra_data": [] "extra_data": []
}, },

View File

@ -1,7 +1,7 @@
<?php <?php
register_module([ register_module([
"name" => "Uploader", "name" => "Uploader",
"version" => "0.5.17", "version" => "0.6",
"author" => "Starbeamrainbowlabs", "author" => "Starbeamrainbowlabs",
"description" => "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File/' prefix.", "description" => "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File/' prefix.",
"id" => "feature-upload", "id" => "feature-upload",
@ -510,6 +510,11 @@ register_module([
case "pdf": case "pdf":
$preview_html .= "\t\t\t<object type='application/pdf' data='$originalUrl'></object>"; $preview_html .= "\t\t\t<object type='application/pdf' data='$originalUrl'></object>";
break; break;
default:
$preview_html .= "\t\t\t<p><em>No preview is available, but you can download it instead:</em></p>
<a class='button' href='$originalUrl'>Download</a>";
break;
} }
$fileInfo = []; $fileInfo = [];

View File

@ -36,6 +36,7 @@ input[type=button], input[type=submit] { cursor: pointer; }
.image-controls ul { list-style-type: none; margin: 5px; padding: 5px; } .image-controls ul { list-style-type: none; margin: 5px; padding: 5px; }
.image-controls li { display: inline-block; margin: 5px; padding: 5px; } .image-controls li { display: inline-block; margin: 5px; padding: 5px; }
.link-display { margin-left: 0.5rem; } .link-display { margin-left: 0.5rem; }
.button { appearance: button; -moz-appearance: button; -webkit-appearance: button; text-decoration: none; }
audio, video, img { max-width: 100%; } audio, video, img { max-width: 100%; }
object { width: 100%; height: 90vh; } object { width: 100%; height: 90vh; }