ui: 修复markdown视频渲染

This commit is contained in:
undefined committed 2021-07-05 15:59:45 +08:00
1 parent 8126680af1
commit ae0d50d99e
2 files changed
+6 -5

No files matched your search

@@ -86,13 +86,14 @@ function videoUrl(service, videoID, url, options) {
case 'osf': case 'osf':
return `https://mfr.osf.io/render?url=https://osf.io/${videoID}/?action=download`; return `https://mfr.osf.io/render?url=https://osf.io/${videoID}/?action=download`;
default: default:
return service; return videoID;
} }
} }
module.exports = function videoPlugin(md) { module.exports = function videoPlugin(md) {
const options = { const options = {
url: videoUrl, url: videoUrl,
video: videoUrl,
youtube: { width: 640, height: 390, nocookie: false }, youtube: { width: 640, height: 390, nocookie: false },
vimeo: { width: 500, height: 281 }, vimeo: { width: 500, height: 281 },
vine: { width: 600, height: 600, embed: 'simple' }, vine: { width: 600, height: 600, embed: 'simple' },
@@ -118,9 +119,9 @@ module.exports = function videoPlugin(md) {
+ ' }); </script>'; + ' }); </script>';
} }
if (service === 'pdf') return `<iframe src="${videoID}?noDisposition=on#view=fit" width="100%" style="min-height: 100vh;border: none;"></iframe>`; if (service === 'pdf') return `<iframe src="${videoID}?noDisposition=on#view=fit" width="100%" style="min-height: 100vh;border: none;"></iframe>`;
if (service === 'video') { if (options[service]) {
return `<div class="embed-responsive embed-responsive-16by9"><iframe class="embed-responsive-item ${service}-player" type="text/html" width="${options[service].width return `<div class="embed-responsive embed-responsive-16by9"><iframe class="embed-responsive-item ${service}-player" type="text/html" width="${options[service].width || 640
}" height="${options[service].height }" height="${options[service].height || 390
}" src="${options.url(service, videoID, tokens[idx].url, options) }" src="${options.url(service, videoID, tokens[idx].url, options)
}" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`; }" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`;
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.12.13", "version": "4.12.14",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "hydro.js", "main": "hydro.js",