fix: improve pdf rendering and html

This commit is contained in:
tdurieux
2026-08-06 14:35:21 -07:00
parent e54b78c7e6
commit f0fdd9250b
202 changed files with 999 additions and 2051 deletions
+24
View File
@@ -91,6 +91,30 @@
aria-label="Edit"
><i class="far fa-edit"></i><span class="d-none d-md-inline"> Edit</span></a
>
<button
ng-if="type == 'html-doc' && !showSource"
ng-click="toggleAllowScripts()"
class="btn btn-sm"
ng-class="{'btn-active': allowScripts}"
aria-label="Allow this document to run JavaScript"
title="Scripts in this file are blocked by default. Enable them only if you trust the repository — the document stays isolated from your session either way."
>
<i class="fab fa-js"></i><span class="d-none d-md-inline">
{{ allowScripts ? "JS on" : "JS off" }}</span
>
</button>
<button
ng-if="type == 'html-doc'"
ng-click="toggleSource()"
class="btn btn-sm"
aria-label="Toggle between the rendered document and its source"
title="Toggle between the rendered document and its source"
>
<i class="fas" ng-class="showSource ? 'fa-eye' : 'fa-code'"></i
><span class="d-none d-md-inline">
{{ showSource ? "Rendered" : "Source" }}</span
>
</button>
<a
ng-show="content != null"
ng-href="{{url}}"
+12 -4
View File
@@ -1,11 +1,19 @@
<div ng-if="type == 'text'" ng-model="content" ui-ace="aceOption"></div>
<div ng-if="type == 'html'" ng-bind-html="content" class="file-content markdown-body"></div>
<div ng-if="type == 'code' && content != null" ui-ace="aceOption" ng-model="content"></div>
<html-doc
ng-if="type == 'html-doc' && !showSource && content != null"
content="content"
base-url="{{fileBaseUrl}}"
allow-scripts="allowScripts"
></html-doc>
<div
ng-if="(type == 'code' || (type == 'html-doc' && showSource)) && content != null"
ui-ace="aceOption"
ng-model="content"
></div>
<img ng-if="type == 'image'" class="image-content" ng-src="{{url}}"></img>
<iframe class="h-100 overflow-auto w-100 b-0" ng-if="type == 'media'" ng-src="{{url}}"></iframe>
<div class="h-100 overflow-auto" ng-if="type == 'pdf'">
<pdfviewer class="h-100 overflow-auto" src="{{url}}" id="viewer"></pdfviewer>
</div>
<pdfviewer ng-if="type == 'pdf'" src="{{url}}"></pdfviewer>
<div ng-if="type == 'audio'"><audio controls="controls"><source ng-src="{{url}}" /></audio></div>
<div ng-if="type == 'IPython'"><notebook file="url"></notebook></div>
<div ng-if="type == 'rate_limited'" class="file-error container d-flex h-100">