mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-04-17 22:03:41 +00:00
Address PR review feedback
This commit is contained in:
@@ -779,6 +779,10 @@
|
|||||||
toggleTreePanelIconEl.textContent = collapsed ? ">" : "<";
|
toggleTreePanelIconEl.textContent = collapsed ? ">" : "<";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isDirectoryNode(node) {
|
||||||
|
return !!node && Array.isArray(node.children);
|
||||||
|
}
|
||||||
|
|
||||||
function countTreeStats(nodes) {
|
function countTreeStats(nodes) {
|
||||||
var stats = { folders: 0, files: 0 };
|
var stats = { folders: 0, files: 0 };
|
||||||
var queue = [].concat(nodes || []);
|
var queue = [].concat(nodes || []);
|
||||||
@@ -787,7 +791,7 @@
|
|||||||
if (!node) {
|
if (!node) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (node.children && node.children.length) {
|
if (isDirectoryNode(node)) {
|
||||||
stats.folders += 1;
|
stats.folders += 1;
|
||||||
queue = queue.concat(node.children);
|
queue = queue.concat(node.children);
|
||||||
} else {
|
} else {
|
||||||
@@ -841,7 +845,8 @@
|
|||||||
|
|
||||||
function normalizeTreeNodes(nodes) {
|
function normalizeTreeNodes(nodes) {
|
||||||
(nodes || []).forEach(function (node) {
|
(nodes || []).forEach(function (node) {
|
||||||
if (node.children && node.children.length) {
|
if (isDirectoryNode(node)) {
|
||||||
|
node.isParent = true;
|
||||||
normalizeTreeNodes(node.children);
|
normalizeTreeNodes(node.children);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -851,7 +856,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function decorateTreeNode(treeId, treeNode) {
|
function decorateTreeNode(treeId, treeNode) {
|
||||||
if (treeNode.isParent) {
|
if (isDirectoryNode(treeNode)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var anchor = $("#" + treeNode.tId + "_a");
|
var anchor = $("#" + treeNode.tId + "_a");
|
||||||
@@ -903,7 +908,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleNodeClick(event, treeId, treeNode) {
|
function handleNodeClick(event, treeId, treeNode) {
|
||||||
if (treeNode.isParent) {
|
if (isDirectoryNode(treeNode)) {
|
||||||
zTreeObj.expandNode(treeNode, !treeNode.open, false, false, false);
|
zTreeObj.expandNode(treeNode, !treeNode.open, false, false, false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,14 @@
|
|||||||
body {
|
body {
|
||||||
background-color: #f1f3f5;
|
background-color: #f1f3f5;
|
||||||
}
|
}
|
||||||
.viewer-container:focus,
|
.viewer-container:focus {
|
||||||
.viewer-container:focus-visible {
|
|
||||||
outline: none !important;
|
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 { width: 800px; margin: 0 auto; font-size: 0;}
|
||||||
#image li { display: inline-block;width: 50px;height: 50px; margin-left: 1%; padding-top: 1%;}
|
#image li { display: inline-block;width: 50px;height: 50px; margin-left: 1%; padding-top: 1%;}
|
||||||
/*#dowebok li img { width: 200%;}*/
|
/*#dowebok li img { width: 200%;}*/
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ public class PdfViewerCompatibilityTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldOpenPdfPreviewWithThumbnailSidebarByDefault() throws IOException {
|
void shouldOpenPdfPreviewWithThumbnailSidebarByDefault() throws IOException {
|
||||||
String pdfTemplate = readWebResource("/web/pdf.ftl");
|
String pdfTemplate = readResource("/web/pdf.ftl");
|
||||||
|
|
||||||
assertTrue(pdfTemplate.contains("#page=1&pagemode=thumbs"));
|
assertTrue(pdfTemplate.contains("#page=1&pagemode=thumbs"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldPreferPdfForOfficePreviewByDefault() throws IOException {
|
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}"));
|
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);
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user