zhangdocs 1.1.18 → 1.1.20
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/index.html
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
</script>
|
|
41
|
-
<script src="https://
|
|
41
|
+
<script src="https://static.docs-hub.com/mermaidmin_1764833418462.js"></script>
|
|
42
42
|
<script>
|
|
43
43
|
document.addEventListener('DOMContentLoaded', function () {
|
|
44
44
|
mermaid.initialize({
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zhangdocs",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.20",
|
|
4
4
|
"description": "Simple document generation tool. Dependence Node.js run.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://github
|
|
7
|
+
"url": "https://github.com/jaywcjlove/zhangdocs.git"
|
|
8
8
|
},
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"bin": {
|
package/theme/handbook/head.ejs
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
</title>
|
|
11
11
|
<link rel="stylesheet" href="<%=relative_path%>static/css/main.css">
|
|
12
12
|
<link rel="stylesheet" href="https://static.docs-hub.com/bootstrapmin_1645176572503.css">
|
|
13
|
+
<!-- Viewer.js 图片预览库 -->
|
|
14
|
+
<link rel="stylesheet" href="https://static.docs-hub.com/viewermin_1764834568346.css">
|
|
15
|
+
<script src="https://static.docs-hub.com/viewermin_1764834557521.js"></script>
|
|
13
16
|
<!-- MathJax 配置 -->
|
|
14
17
|
<script>
|
|
15
18
|
MathJax = {
|
|
@@ -24,8 +27,8 @@
|
|
|
24
27
|
};
|
|
25
28
|
</script>
|
|
26
29
|
<!-- 加载 MathJax -->
|
|
27
|
-
<script id="MathJax-script" async src="https://
|
|
28
|
-
<script src="https://
|
|
30
|
+
<script id="MathJax-script" async src="https://static.docs-hub.com/texsvg_1764833463111.js"></script>
|
|
31
|
+
<script src="https://static.docs-hub.com/mermaidmin_1764833418462.js"></script>
|
|
29
32
|
<script>
|
|
30
33
|
document.addEventListener('DOMContentLoaded', function () {
|
|
31
34
|
mermaid.initialize({
|
|
@@ -292,5 +292,87 @@ style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background:
|
|
|
292
292
|
// 延迟初始化(处理动态显示的情况)
|
|
293
293
|
setTimeout(initMenuPopup, 500);
|
|
294
294
|
setTimeout(initMenuPopup, 1000);
|
|
295
|
+
|
|
296
|
+
// 图片预览功能初始化
|
|
297
|
+
(function() {
|
|
298
|
+
var imageViewer = null;
|
|
299
|
+
|
|
300
|
+
function initImageViewer() {
|
|
301
|
+
// 查找markdown-body容器
|
|
302
|
+
var markdownBody = document.querySelector('.markdown-body');
|
|
303
|
+
if (!markdownBody) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// 查找所有图片
|
|
308
|
+
var images = markdownBody.querySelectorAll('img');
|
|
309
|
+
if (images.length === 0) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// 如果Viewer已经初始化,先销毁
|
|
314
|
+
if (imageViewer) {
|
|
315
|
+
try {
|
|
316
|
+
imageViewer.destroy();
|
|
317
|
+
} catch(e) {
|
|
318
|
+
// 忽略错误
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// 为图片添加样式和点击事件
|
|
323
|
+
images.forEach(function(img) {
|
|
324
|
+
// 跳过已经是链接内的图片
|
|
325
|
+
if (img.parentElement.tagName === 'A') {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// 添加样式
|
|
330
|
+
img.style.cursor = 'zoom-in';
|
|
331
|
+
img.classList.add('image-preview');
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
// 初始化Viewer.js - 直接对markdown-body容器初始化
|
|
335
|
+
try {
|
|
336
|
+
imageViewer = new Viewer(markdownBody, {
|
|
337
|
+
inline: false,
|
|
338
|
+
viewed: function() {
|
|
339
|
+
// 查看图片时的回调
|
|
340
|
+
},
|
|
341
|
+
hidden: function() {
|
|
342
|
+
// 关闭查看器时的回调
|
|
343
|
+
},
|
|
344
|
+
toolbar: {
|
|
345
|
+
zoomIn: true,
|
|
346
|
+
zoomOut: true,
|
|
347
|
+
oneToOne: true,
|
|
348
|
+
reset: true,
|
|
349
|
+
prev: true,
|
|
350
|
+
play: false,
|
|
351
|
+
next: true,
|
|
352
|
+
rotateLeft: true,
|
|
353
|
+
rotateRight: true,
|
|
354
|
+
flipHorizontal: true,
|
|
355
|
+
flipVertical: true
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
} catch(e) {
|
|
359
|
+
console.error('图片预览初始化失败:', e);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// 立即尝试初始化
|
|
364
|
+
initImageViewer();
|
|
365
|
+
|
|
366
|
+
// DOM加载完成后初始化
|
|
367
|
+
if (document.readyState === 'loading') {
|
|
368
|
+
document.addEventListener('DOMContentLoaded', initImageViewer);
|
|
369
|
+
} else {
|
|
370
|
+
setTimeout(initImageViewer, 100);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// 延迟初始化(处理动态显示的情况)
|
|
374
|
+
setTimeout(initImageViewer, 500);
|
|
375
|
+
setTimeout(initImageViewer, 1000);
|
|
376
|
+
})();
|
|
295
377
|
</script>
|
|
296
378
|
<% include footer.ejs %>
|
|
@@ -22,9 +22,14 @@
|
|
|
22
22
|
max-width: 100%
|
|
23
23
|
height: auto
|
|
24
24
|
border-radius: 4px
|
|
25
|
+
transition: opacity 0.2s ease
|
|
25
26
|
@media mq-mobile
|
|
26
27
|
display: block
|
|
27
28
|
margin: 12px auto
|
|
29
|
+
&.image-preview
|
|
30
|
+
cursor: zoom-in
|
|
31
|
+
&:hover
|
|
32
|
+
opacity: 0.9
|
|
28
33
|
a
|
|
29
34
|
color: #0969da
|
|
30
35
|
text-decoration: none
|