nodebb-plugin-pdf-secure 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/library.js +6 -2
- package/package.json +1 -1
- package/static/style.less +15 -22
package/library.js
CHANGED
|
@@ -57,8 +57,13 @@ plugin.init = async (params) => {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
// Inject the filename and config into the viewer
|
|
60
|
+
// Also inject CSS to hide uploadOverlay immediately
|
|
60
61
|
const injectedHtml = html
|
|
61
62
|
.replace('</head>', `
|
|
63
|
+
<style>
|
|
64
|
+
/* Hide upload overlay since PDF will auto-load */
|
|
65
|
+
#uploadOverlay { display: none !important; }
|
|
66
|
+
</style>
|
|
62
67
|
<script>
|
|
63
68
|
window.PDF_SECURE_CONFIG = {
|
|
64
69
|
filename: ${JSON.stringify(safeName)},
|
|
@@ -66,8 +71,7 @@ plugin.init = async (params) => {
|
|
|
66
71
|
csrfToken: ${JSON.stringify(req.csrfToken ? req.csrfToken() : '')}
|
|
67
72
|
};
|
|
68
73
|
</script>
|
|
69
|
-
</head>`)
|
|
70
|
-
.replace('id="uploadOverlay">', 'id="uploadOverlay" class="hidden">');
|
|
74
|
+
</head>`);
|
|
71
75
|
|
|
72
76
|
res.type('html').send(injectedHtml);
|
|
73
77
|
});
|
package/package.json
CHANGED
package/static/style.less
CHANGED
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
/* PDF Secure Viewer — Inline Embed Styles for NodeBB */
|
|
2
2
|
|
|
3
|
-
/* Hide NodeBB
|
|
4
|
-
[component="post/content"]
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
>svg[viewBox],
|
|
9
|
-
>p>img[alt*=".pdf"],
|
|
10
|
-
>img[alt*=".pdf"],
|
|
11
|
-
.file-icon,
|
|
12
|
-
.attachment-icon {
|
|
13
|
-
|
|
14
|
-
&:has(+ .pdf-secure-embed),
|
|
15
|
-
&:has(~ .pdf-secure-embed) {
|
|
16
|
-
display: none !important;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
3
|
+
/* AGGRESSIVE: Hide NodeBB's large file preview SVG icons */
|
|
4
|
+
[component="post/content"]>p>svg,
|
|
5
|
+
[component="post/content"]>svg,
|
|
6
|
+
[component="post/content"] svg[viewBox="0 0 24 24"]:not(.pdf-secure-embed svg) {
|
|
7
|
+
display: none !important;
|
|
19
8
|
}
|
|
20
9
|
|
|
21
|
-
/*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
/* Hide any standalone large SVG that looks like a file icon */
|
|
11
|
+
[component="post/content"]>p:has(svg[viewBox]) {
|
|
12
|
+
|
|
13
|
+
/* If paragraph only contains an SVG, hide the whole paragraph */
|
|
14
|
+
&:not(:has(.pdf-secure-embed)):not(:has(a)):not(:has(span)):not(:has(img)) {
|
|
15
|
+
display: none !important;
|
|
16
|
+
}
|
|
27
17
|
}
|
|
28
18
|
|
|
29
19
|
/* Embedded PDF Container */
|
|
@@ -60,6 +50,8 @@ img[alt*=".pdf"]:has(+ .pdf-secure-embed) {
|
|
|
60
50
|
height: 20px;
|
|
61
51
|
fill: #e81224;
|
|
62
52
|
flex-shrink: 0;
|
|
53
|
+
/* Make sure our header icon is visible */
|
|
54
|
+
display: inline-block !important;
|
|
63
55
|
}
|
|
64
56
|
|
|
65
57
|
.pdf-secure-embed-title span {
|
|
@@ -95,6 +87,7 @@ img[alt*=".pdf"]:has(+ .pdf-secure-embed) {
|
|
|
95
87
|
width: 18px;
|
|
96
88
|
height: 18px;
|
|
97
89
|
fill: #fff;
|
|
90
|
+
display: inline-block !important;
|
|
98
91
|
}
|
|
99
92
|
|
|
100
93
|
/* Viewer Body */
|