feat: 为 Mermaid 添加本地镜像支持

- 在设置页添加'使用本地镜像'复选框选项
- 修改 footer.php 添加本地镜像判断逻辑
- 下载 Mermaid 10.x 本地镜像文件到 assets/vendor/external/mermaid/
- 本地镜像文件大小约 3.3MB
- 勾选后优先使用主题内置版本,提升加载速度
- 添加 argon_mermaid_use_local 选项保存逻辑
This commit is contained in:
2026-01-23 18:55:08 +08:00
parent 627a57c5e9
commit 7feca8f17d
3 changed files with 2060 additions and 3 deletions

View File

@@ -149,7 +149,21 @@
<?php if (get_option('argon_enable_mermaid') == 'true') { /*Mermaid*/?>
<script src="<?php echo get_option('argon_mermaid_cdn_url') == '' ? '//cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js' : get_option('argon_mermaid_cdn_url'); ?>"></script>
<?php
// 判断是否使用本地镜像
$mermaid_url = get_option('argon_mermaid_cdn_url') == '' ? '//cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js' : get_option('argon_mermaid_cdn_url');
if (get_option('argon_mermaid_use_local') == 'true') {
$mermaid_url = $GLOBALS['assets_path'] . '/assets/vendor/external/mermaid/mermaid.min.js';
}
?>
<script src="<?php echo $mermaid_url; ?>"></script>
<script>