Skip to content

Commit a8a08c1

Browse files
committed
Address PR review feedback
1 parent 7757729 commit a8a08c1

3 files changed

Lines changed: 17 additions & 22 deletions

File tree

server/src/main/resources/web/compress.ftl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,10 @@
779779
toggleTreePanelIconEl.textContent = collapsed ? ">" : "<";
780780
}
781781
782+
function isDirectoryNode(node) {
783+
return !!node && Array.isArray(node.children);
784+
}
785+
782786
function countTreeStats(nodes) {
783787
var stats = { folders: 0, files: 0 };
784788
var queue = [].concat(nodes || []);
@@ -787,7 +791,7 @@
787791
if (!node) {
788792
continue;
789793
}
790-
if (node.children && node.children.length) {
794+
if (isDirectoryNode(node)) {
791795
stats.folders += 1;
792796
queue = queue.concat(node.children);
793797
} else {
@@ -841,7 +845,8 @@
841845
842846
function normalizeTreeNodes(nodes) {
843847
(nodes || []).forEach(function (node) {
844-
if (node.children && node.children.length) {
848+
if (isDirectoryNode(node)) {
849+
node.isParent = true;
845850
normalizeTreeNodes(node.children);
846851
return;
847852
}
@@ -851,7 +856,7 @@
851856
}
852857
853858
function decorateTreeNode(treeId, treeNode) {
854-
if (treeNode.isParent) {
859+
if (isDirectoryNode(treeNode)) {
855860
return;
856861
}
857862
var anchor = $("#" + treeNode.tId + "_a");
@@ -903,7 +908,7 @@
903908
}
904909
905910
function handleNodeClick(event, treeId, treeNode) {
906-
if (treeNode.isParent) {
911+
if (isDirectoryNode(treeNode)) {
907912
zTreeObj.expandNode(treeNode, !treeNode.open, false, false, false);
908913
return false;
909914
}

server/src/main/resources/web/picture.ftl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
body {
1212
background-color: #f1f3f5;
1313
}
14-
.viewer-container:focus,
15-
.viewer-container:focus-visible {
14+
.viewer-container:focus {
1615
outline: none !important;
1716
}
17+
.viewer-container:focus-visible {
18+
outline: 2px solid rgba(95, 107, 122, 0.65) !important;
19+
outline-offset: 2px;
20+
box-shadow: 0 0 0 4px rgba(95, 107, 122, 0.14);
21+
}
1822
#image { width: 800px; margin: 0 auto; font-size: 0;}
1923
#image li { display: inline-block;width: 50px;height: 50px; margin-left: 1%; padding-top: 1%;}
2024
/*#dowebok li img { width: 200%;}*/

server/src/test/java/cn/keking/PdfViewerCompatibilityTests.java

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ void shouldLoadCompatibilityModuleInPdfWorker() throws IOException {
2828

2929
@Test
3030
void shouldOpenPdfPreviewWithThumbnailSidebarByDefault() throws IOException {
31-
String pdfTemplate = readWebResource("/web/pdf.ftl");
31+
String pdfTemplate = readResource("/web/pdf.ftl");
3232

3333
assertTrue(pdfTemplate.contains("#page=1&pagemode=thumbs"));
3434
}
3535

3636
@Test
3737
void shouldPreferPdfForOfficePreviewByDefault() throws IOException {
38-
String properties = readConfigResource("/application.properties");
38+
String properties = readResource("/application.properties");
3939

4040
assertTrue(properties.contains("office.preview.type = ${KK_OFFICE_PREVIEW_TYPE:pdf}"));
4141
}
@@ -46,18 +46,4 @@ private String readResource(String resourcePath) throws IOException {
4646
return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
4747
}
4848
}
49-
50-
private String readWebResource(String resourcePath) throws IOException {
51-
try (InputStream inputStream = getClass().getResourceAsStream(resourcePath)) {
52-
assertNotNull(inputStream);
53-
return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
54-
}
55-
}
56-
57-
private String readConfigResource(String resourcePath) throws IOException {
58-
try (InputStream inputStream = getClass().getResourceAsStream(resourcePath)) {
59-
assertNotNull(inputStream);
60-
return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
61-
}
62-
}
6349
}

0 commit comments

Comments
 (0)