1
0
Fork 0
forked from forgejo/forgejo

Add PDF rendering via PDFObject (#24086)

Use [PDFObject](https://pdfobject.com/) to embed PDFs, replacing our
outdated PDF.js copy we vendor (the last non-webpack vendoring).

[Commit
1](673e0263da)
is the PDFObject integration
[Commit
2](9336f5769d)
is the removal of PDF.js

<img width="1251" alt="Screenshot 2023-05-27 at 09 57 52"
src="169ce50c-bd1d-4bb0-86e5-1710bd0400a9">
<img width="1257" alt="Screenshot 2023-05-27 at 10 12 50"
src="318f7ee9-fb11-4093-83e7-17475aa70629">


Fallback for unsupporting browsers (most mobile ones, except Firefox
Mobile):

<img width="358" alt="Screenshot 2023-05-27 at 09 43 34"
src="8c12d7ba-57d6-4228-89a0-5fef9fad0cbb">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
silverwind 2023-05-29 14:10:00 +02:00 committed by GitHub
parent 35ce7ca25b
commit e4e98979ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
412 changed files with 61 additions and 124050 deletions

View file

@ -412,26 +412,42 @@
cursor: default;
}
.repository.file.list .non-diff-file-content .view-raw {
padding: 5px;
.view-raw {
display: flex;
justify-content: center;
align-items: center;
}
.repository.file.list .non-diff-file-content .view-raw > * {
.view-raw > * {
max-width: 100%;
border: 1px solid var(--color-secondary);
}
.repository.file.list .non-diff-file-content .view-raw img {
.view-raw audio,
.view-raw video,
.view-raw img {
margin: 1rem 0;
border-radius: 0;
object-fit: contain;
}
.repository.file.list .non-diff-file-content .view-raw img[src$=".svg" i] {
.view-raw img[src$=".svg" i] {
max-height: 600px !important;
max-width: 600px !important;
}
.pdf-content {
width: 100%;
height: 600px;
border: none !important;
display: flex;
align-items: center;
justify-content: center;
}
.pdf-content:has(.pdf-fallback-button) {
height: 100px;
}
.repository.file.list .non-diff-file-content .plain-text {
padding: 1em 2em;
}
@ -454,6 +470,11 @@
padding: 5px !important;
}
.non-diff-file-content .attached.segment,
.non-diff-file-content .pdfobject {
border-radius: 0 0 var(--border-radius) var(--border-radius);
}
.repository.file.list .sidebar {
padding-left: 0;
}