Address PR review feedback

This commit is contained in:
kl
2026-04-13 21:02:59 +08:00
parent 7757729efd
commit a8a08c1dcc
3 changed files with 17 additions and 22 deletions

View File

@@ -779,6 +779,10 @@
toggleTreePanelIconEl.textContent = collapsed ? ">" : "<";
}
function isDirectoryNode(node) {
return !!node && Array.isArray(node.children);
}
function countTreeStats(nodes) {
var stats = { folders: 0, files: 0 };
var queue = [].concat(nodes || []);
@@ -787,7 +791,7 @@
if (!node) {
continue;
}
if (node.children && node.children.length) {
if (isDirectoryNode(node)) {
stats.folders += 1;
queue = queue.concat(node.children);
} else {
@@ -841,7 +845,8 @@
function normalizeTreeNodes(nodes) {
(nodes || []).forEach(function (node) {
if (node.children && node.children.length) {
if (isDirectoryNode(node)) {
node.isParent = true;
normalizeTreeNodes(node.children);
return;
}
@@ -851,7 +856,7 @@
}
function decorateTreeNode(treeId, treeNode) {
if (treeNode.isParent) {
if (isDirectoryNode(treeNode)) {
return;
}
var anchor = $("#" + treeNode.tId + "_a");
@@ -903,7 +908,7 @@
}
function handleNodeClick(event, treeId, treeNode) {
if (treeNode.isParent) {
if (isDirectoryNode(treeNode)) {
zTreeObj.expandNode(treeNode, !treeNode.open, false, false, false);
return false;
}

View File

@@ -11,10 +11,14 @@
body {
background-color: #f1f3f5;
}
.viewer-container:focus,
.viewer-container:focus-visible {
.viewer-container:focus {
outline: none !important;
}
.viewer-container:focus-visible {
outline: 2px solid rgba(95, 107, 122, 0.65) !important;
outline-offset: 2px;
box-shadow: 0 0 0 4px rgba(95, 107, 122, 0.14);
}
#image { width: 800px; margin: 0 auto; font-size: 0;}
#image li { display: inline-block;width: 50px;height: 50px; margin-left: 1%; padding-top: 1%;}
/*#dowebok li img { width: 200%;}*/

View File

@@ -28,14 +28,14 @@ public class PdfViewerCompatibilityTests {
@Test
void shouldOpenPdfPreviewWithThumbnailSidebarByDefault() throws IOException {
String pdfTemplate = readWebResource("/web/pdf.ftl");
String pdfTemplate = readResource("/web/pdf.ftl");
assertTrue(pdfTemplate.contains("#page=1&pagemode=thumbs"));
}
@Test
void shouldPreferPdfForOfficePreviewByDefault() throws IOException {
String properties = readConfigResource("/application.properties");
String properties = readResource("/application.properties");
assertTrue(properties.contains("office.preview.type = ${KK_OFFICE_PREVIEW_TYPE:pdf}"));
}
@@ -46,18 +46,4 @@ public class PdfViewerCompatibilityTests {
return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
}
}
private String readWebResource(String resourcePath) throws IOException {
try (InputStream inputStream = getClass().getResourceAsStream(resourcePath)) {
assertNotNull(inputStream);
return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
}
}
private String readConfigResource(String resourcePath) throws IOException {
try (InputStream inputStream = getClass().getResourceAsStream(resourcePath)) {
assertNotNull(inputStream);
return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
}
}
}