feat: v3 增强 - FTS5全文搜索+双向链接/知识图谱+自动保存草稿+标签管理+实时预览编辑器+PWA

- FTS5中文分词搜索(需-tags=sqlite_fts5)
- [[wiki链接]]反向链接+SVG知识图谱
- 自动保存草稿(不触发版本历史)
- 标签重命名/合并/删除+使用统计
- 后台编辑实时预览+格式工具栏
- PWA manifest+service worker+移动端适配
- 冒烟测试扩至66例全通过
This commit is contained in:
Your Name
2026-08-11 12:38:41 +08:00
parent cbfaac3d4f
commit b93c6f1e16
14 changed files with 1720 additions and 16 deletions
+109 -4
View File
@@ -4,6 +4,9 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>云笔记</title>
<link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#1a73e8">
<link rel="apple-touch-icon" href="/icon-192.png">
<!-- Highlight.js 代码高亮 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
@@ -508,16 +511,95 @@
/* 响应式 */
@media (max-width: 768px) {
.sidebar { width: 100%; display: none; }
.sidebar.show { display: block; }
.content { padding: 20px; }
header {
padding: 10px 12px;
}
header h1 { font-size: 16px; }
#menuBtn {
display: block;
flex-shrink: 0;
}
.header-right {
gap: 8px;
}
.search-box {
flex: 1;
padding: 7px 12px;
}
.search-box input {
width: 100%;
font-size: 14px;
}
.search-box svg { width: 18px; height: 18px; }
#darkBtn {
font-size: 0;
padding: 0;
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
#darkBtn::after {
content: '🌙';
font-size: 18px;
}
body.dark #darkBtn::after {
content: '☀️';
}
#darkBtn.btn-light::after { content: '☀️'; }
.main {
flex-direction: column;
height: auto;
min-height: calc(100vh - 57px);
}
/* 边栏在手机端默认隐藏,点开汉堡菜单后显示 */
.sidebar {
width: 100%;
max-height: 50vh;
display: none;
border-right: none;
border-bottom: 1px solid #e0e0e0;
}
.sidebar.show { display: flex; }
.content {
height: auto;
min-height: 60vh;
padding: 0;
flex-direction: column;
}
.toc-sidebar {
display: none !important;
}
.note-area { padding: 16px; }
.note-detail h1 { font-size: 24px; }
.note-content { font-size: 15px; }
.note-content pre { overflow-x: auto; }
.empty-state { padding: 60px 20px; }
.note-item { padding: 12px; }
.filter-item { padding: 12px; font-size: 14px; }
.tree-node { padding: 12px 10px; }
.tree-label { font-size: 14px; }
header a { font-size: 13px; }
footer { font-size: 11px; padding: 16px 12px; }
}
@media (max-width: 480px) {
header h1 { display: none; }
.header-right .search-box { max-width: none; }
.wrap-text { word-break: break-word; }
}
</style>
</head>
<body>
<header>
<h1>云笔记</h1>
<div style="display:flex;align-items:center;gap:12px;">
<button id="menuBtn" aria-label="切换目录" style="display:none;background:none;border:1px solid #ccc;border-radius:8px;width:40px;height:40px;cursor:pointer;color:#666;font-size:20px;line-height:1;"></button>
<h1>云笔记</h1>
</div>
<div class="header-right">
<div class="search-box">
<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>
@@ -1058,8 +1140,31 @@
}
}
// 移动端:汉堡菜单切换左侧目录
function toggleSidebar() {
const sidebar = document.querySelector('.sidebar');
sidebar.classList.toggle('show');
}
// PWA:注册 Service Worker(简单、幂等;失败不阻塞页面)
function registerServiceWorker() {
if (!('serviceWorker' in navigator)) return;
window.addEventListener('load', function() {
navigator.serviceWorker.register('/sw.js').catch(function(err) {
console.warn('Service Worker 注册失败:', err);
});
});
}
// 菜单按钮绑定
document.addEventListener('DOMContentLoaded', function() {
const menuBtn = document.getElementById('menuBtn');
if (menuBtn) menuBtn.addEventListener('click', toggleSidebar);
});
init();
initSiteDark();
registerServiceWorker();
</script>
</body>
</html>