Skip to content

Commit 5c2a840

Browse files
committed
feat: 新增 pdf 预览功能
1 parent e37dcce commit 5c2a840

18 files changed

Lines changed: 955 additions & 3 deletions

bindata/static/css/filemanager.css

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,4 +1708,79 @@ input[type="checkbox"] {
17081708
height: 20px;
17091709
fill: currentColor;
17101710
flex-shrink: 0;
1711+
}
1712+
1713+
/* PDF Preview Styles */
1714+
.pdf-preview-container {
1715+
display: flex;
1716+
flex-direction: column;
1717+
height: 100%;
1718+
width: 100%;
1719+
background: #1a1a1a;
1720+
}
1721+
1722+
.pdf-controls {
1723+
display: flex;
1724+
align-items: center;
1725+
justify-content: center;
1726+
gap: 20px;
1727+
padding: 15px;
1728+
background: #1e1e1e;
1729+
border-bottom: 1px solid #333;
1730+
flex-shrink: 0;
1731+
}
1732+
1733+
.pdf-nav-btn {
1734+
background: transparent;
1735+
border: 1px solid #444;
1736+
color: #cccccc;
1737+
padding: 8px 12px;
1738+
border-radius: 6px;
1739+
cursor: pointer;
1740+
display: flex;
1741+
align-items: center;
1742+
justify-content: center;
1743+
transition: all 0.2s;
1744+
}
1745+
1746+
.pdf-nav-btn:hover:not(:disabled) {
1747+
background: #2d2d2d;
1748+
border-color: #5dade2;
1749+
color: #5dade2;
1750+
}
1751+
1752+
.pdf-nav-btn:disabled {
1753+
opacity: 0.3;
1754+
cursor: not-allowed;
1755+
}
1756+
1757+
.pdf-nav-btn svg {
1758+
width: 20px;
1759+
height: 20px;
1760+
fill: currentColor;
1761+
}
1762+
1763+
.pdf-page-info {
1764+
color: #cccccc;
1765+
font-size: 14px;
1766+
font-weight: 500;
1767+
min-width: 80px;
1768+
text-align: center;
1769+
}
1770+
1771+
.pdf-canvas-wrapper {
1772+
flex: 1;
1773+
overflow: auto;
1774+
display: flex;
1775+
justify-content: center;
1776+
align-items: flex-start;
1777+
padding: 20px;
1778+
background: #1a1a1a;
1779+
}
1780+
1781+
.pdf-canvas {
1782+
max-width: 100%;
1783+
height: auto;
1784+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
1785+
background: white;
17111786
}

bindata/static/js/FileManager.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
interface FileManagerProps {
2+
onClose: () => void;
3+
}
4+
export declare const FileManager: ({ onClose }: FileManagerProps) => import("preact").JSX.Element;
5+
export {};

bindata/static/js/Login.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
interface LoginProps {
2+
onSuccess: (token: string) => void;
3+
}
4+
export declare const Login: ({ onSuccess }: LoginProps) => import("preact").JSX.Element;
5+
export {};

bindata/static/js/MyModal.d.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Component, ComponentChildren } from "preact";
2+
import 'bootstrap/scss/bootstrap.scss';
3+
interface ModalProps {
4+
children: ComponentChildren;
5+
buttons?: ComponentChildren;
6+
title: string;
7+
dismissHandler?: (hideModal?: () => void) => void;
8+
}
9+
export declare class MyModal extends Component<ModalProps, {}> {
10+
ref: import("preact").RefObject<HTMLDivElement>;
11+
constructor();
12+
componentDidMount(): void;
13+
componentWillUnmount(): void;
14+
hide(): void;
15+
render(): import("preact").JSX.Element;
16+
}
17+
interface ButtonProps {
18+
priority: "primary" | "secondary" | "danger";
19+
clickHandler?: () => void;
20+
children: ComponentChildren;
21+
disabled?: boolean;
22+
}
23+
export declare function Button(props: ButtonProps): import("preact").JSX.Element;
24+
export {};

bindata/static/js/gotty.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindata/static/js/gotty.js.LICENSE.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,25 @@ https://github.com/nodeca/pako/blob/main/LICENSE
2828
/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */
2929

3030
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
31+
32+
/**
33+
* @licstart The following is the entire license notice for the
34+
* JavaScript code in this page
35+
*
36+
* Copyright 2024 Mozilla Foundation
37+
*
38+
* Licensed under the Apache License, Version 2.0 (the "License");
39+
* you may not use this file except in compliance with the License.
40+
* You may obtain a copy of the License at
41+
*
42+
* http://www.apache.org/licenses/LICENSE-2.0
43+
*
44+
* Unless required by applicable law or agreed to in writing, software
45+
* distributed under the License is distributed on an "AS IS" BASIS,
46+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
47+
* See the License for the specific language governing permissions and
48+
* limitations under the License.
49+
*
50+
* @licend The above is the entire license notice for the
51+
* JavaScript code in this page
52+
*/

bindata/static/js/gotty.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindata/static/js/gotty.licenses.txt

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,187 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
12731273
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12741274

12751275

1276+
pdfjs-dist
1277+
Apache-2.0
1278+
1279+
Apache License
1280+
Version 2.0, January 2004
1281+
http://www.apache.org/licenses/
1282+
1283+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1284+
1285+
1. Definitions.
1286+
1287+
"License" shall mean the terms and conditions for use, reproduction,
1288+
and distribution as defined by Sections 1 through 9 of this document.
1289+
1290+
"Licensor" shall mean the copyright owner or entity authorized by
1291+
the copyright owner that is granting the License.
1292+
1293+
"Legal Entity" shall mean the union of the acting entity and all
1294+
other entities that control, are controlled by, or are under common
1295+
control with that entity. For the purposes of this definition,
1296+
"control" means (i) the power, direct or indirect, to cause the
1297+
direction or management of such entity, whether by contract or
1298+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
1299+
outstanding shares, or (iii) beneficial ownership of such entity.
1300+
1301+
"You" (or "Your") shall mean an individual or Legal Entity
1302+
exercising permissions granted by this License.
1303+
1304+
"Source" form shall mean the preferred form for making modifications,
1305+
including but not limited to software source code, documentation
1306+
source, and configuration files.
1307+
1308+
"Object" form shall mean any form resulting from mechanical
1309+
transformation or translation of a Source form, including but
1310+
not limited to compiled object code, generated documentation,
1311+
and conversions to other media types.
1312+
1313+
"Work" shall mean the work of authorship, whether in Source or
1314+
Object form, made available under the License, as indicated by a
1315+
copyright notice that is included in or attached to the work
1316+
(an example is provided in the Appendix below).
1317+
1318+
"Derivative Works" shall mean any work, whether in Source or Object
1319+
form, that is based on (or derived from) the Work and for which the
1320+
editorial revisions, annotations, elaborations, or other modifications
1321+
represent, as a whole, an original work of authorship. For the purposes
1322+
of this License, Derivative Works shall not include works that remain
1323+
separable from, or merely link (or bind by name) to the interfaces of,
1324+
the Work and Derivative Works thereof.
1325+
1326+
"Contribution" shall mean any work of authorship, including
1327+
the original version of the Work and any modifications or additions
1328+
to that Work or Derivative Works thereof, that is intentionally
1329+
submitted to Licensor for inclusion in the Work by the copyright owner
1330+
or by an individual or Legal Entity authorized to submit on behalf of
1331+
the copyright owner. For the purposes of this definition, "submitted"
1332+
means any form of electronic, verbal, or written communication sent
1333+
to the Licensor or its representatives, including but not limited to
1334+
communication on electronic mailing lists, source code control systems,
1335+
and issue tracking systems that are managed by, or on behalf of, the
1336+
Licensor for the purpose of discussing and improving the Work, but
1337+
excluding communication that is conspicuously marked or otherwise
1338+
designated in writing by the copyright owner as "Not a Contribution."
1339+
1340+
"Contributor" shall mean Licensor and any individual or Legal Entity
1341+
on behalf of whom a Contribution has been received by Licensor and
1342+
subsequently incorporated within the Work.
1343+
1344+
2. Grant of Copyright License. Subject to the terms and conditions of
1345+
this License, each Contributor hereby grants to You a perpetual,
1346+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1347+
copyright license to reproduce, prepare Derivative Works of,
1348+
publicly display, publicly perform, sublicense, and distribute the
1349+
Work and such Derivative Works in Source or Object form.
1350+
1351+
3. Grant of Patent License. Subject to the terms and conditions of
1352+
this License, each Contributor hereby grants to You a perpetual,
1353+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1354+
(except as stated in this section) patent license to make, have made,
1355+
use, offer to sell, sell, import, and otherwise transfer the Work,
1356+
where such license applies only to those patent claims licensable
1357+
by such Contributor that are necessarily infringed by their
1358+
Contribution(s) alone or by combination of their Contribution(s)
1359+
with the Work to which such Contribution(s) was submitted. If You
1360+
institute patent litigation against any entity (including a
1361+
cross-claim or counterclaim in a lawsuit) alleging that the Work
1362+
or a Contribution incorporated within the Work constitutes direct
1363+
or contributory patent infringement, then any patent licenses
1364+
granted to You under this License for that Work shall terminate
1365+
as of the date such litigation is filed.
1366+
1367+
4. Redistribution. You may reproduce and distribute copies of the
1368+
Work or Derivative Works thereof in any medium, with or without
1369+
modifications, and in Source or Object form, provided that You
1370+
meet the following conditions:
1371+
1372+
(a) You must give any other recipients of the Work or
1373+
Derivative Works a copy of this License; and
1374+
1375+
(b) You must cause any modified files to carry prominent notices
1376+
stating that You changed the files; and
1377+
1378+
(c) You must retain, in the Source form of any Derivative Works
1379+
that You distribute, all copyright, patent, trademark, and
1380+
attribution notices from the Source form of the Work,
1381+
excluding those notices that do not pertain to any part of
1382+
the Derivative Works; and
1383+
1384+
(d) If the Work includes a "NOTICE" text file as part of its
1385+
distribution, then any Derivative Works that You distribute must
1386+
include a readable copy of the attribution notices contained
1387+
within such NOTICE file, excluding those notices that do not
1388+
pertain to any part of the Derivative Works, in at least one
1389+
of the following places: within a NOTICE text file distributed
1390+
as part of the Derivative Works; within the Source form or
1391+
documentation, if provided along with the Derivative Works; or,
1392+
within a display generated by the Derivative Works, if and
1393+
wherever such third-party notices normally appear. The contents
1394+
of the NOTICE file are for informational purposes only and
1395+
do not modify the License. You may add Your own attribution
1396+
notices within Derivative Works that You distribute, alongside
1397+
or as an addendum to the NOTICE text from the Work, provided
1398+
that such additional attribution notices cannot be construed
1399+
as modifying the License.
1400+
1401+
You may add Your own copyright statement to Your modifications and
1402+
may provide additional or different license terms and conditions
1403+
for use, reproduction, or distribution of Your modifications, or
1404+
for any such Derivative Works as a whole, provided Your use,
1405+
reproduction, and distribution of the Work otherwise complies with
1406+
the conditions stated in this License.
1407+
1408+
5. Submission of Contributions. Unless You explicitly state otherwise,
1409+
any Contribution intentionally submitted for inclusion in the Work
1410+
by You to the Licensor shall be under the terms and conditions of
1411+
this License, without any additional terms or conditions.
1412+
Notwithstanding the above, nothing herein shall supersede or modify
1413+
the terms of any separate license agreement you may have executed
1414+
with Licensor regarding such Contributions.
1415+
1416+
6. Trademarks. This License does not grant permission to use the trade
1417+
names, trademarks, service marks, or product names of the Licensor,
1418+
except as required for reasonable and customary use in describing the
1419+
origin of the Work and reproducing the content of the NOTICE file.
1420+
1421+
7. Disclaimer of Warranty. Unless required by applicable law or
1422+
agreed to in writing, Licensor provides the Work (and each
1423+
Contributor provides its Contributions) on an "AS IS" BASIS,
1424+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1425+
implied, including, without limitation, any warranties or conditions
1426+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
1427+
PARTICULAR PURPOSE. You are solely responsible for determining the
1428+
appropriateness of using or redistributing the Work and assume any
1429+
risks associated with Your exercise of permissions under this License.
1430+
1431+
8. Limitation of Liability. In no event and under no legal theory,
1432+
whether in tort (including negligence), contract, or otherwise,
1433+
unless required by applicable law (such as deliberate and grossly
1434+
negligent acts) or agreed to in writing, shall any Contributor be
1435+
liable to You for damages, including any direct, indirect, special,
1436+
incidental, or consequential damages of any character arising as a
1437+
result of this License or out of the use or inability to use the
1438+
Work (including but not limited to damages for loss of goodwill,
1439+
work stoppage, computer failure or malfunction, or any and all
1440+
other commercial damages or losses), even if such Contributor
1441+
has been advised of the possibility of such damages.
1442+
1443+
9. Accepting Warranty or Additional Liability. While redistributing
1444+
the Work or Derivative Works thereof, You may choose to offer,
1445+
and charge a fee for, acceptance of support, warranty, indemnity,
1446+
or other liability obligations and/or rights consistent with this
1447+
License. However, in accepting such obligations, You may act only
1448+
on Your own behalf and on Your sole responsibility, not on behalf
1449+
of any other Contributor, and only if You agree to indemnify,
1450+
defend, and hold each Contributor harmless for any liability
1451+
incurred by, or claims asserted against, such Contributor by reason
1452+
of your accepting any such warranty or additional liability.
1453+
1454+
END OF TERMS AND CONDITIONS
1455+
1456+
12761457
preact
12771458
MIT
12781459
The MIT License (MIT)

bindata/static/js/main.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

bindata/static/js/pdf.worker.min.js

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)