feat: wangEditor 替换为 ByteMD Markdown 编辑器
- 移除 wangEditor 5 库文件(1.27MB JS + 14KB CSS,含手动 hack) - 集成 ByteMD 1.22.0(基于 CodeMirror 5,不依赖 contentEditable) - 编辑器输出 Markdown 原文,后端 goldmark + bluemonday 双重防护渲染 HTML - 删除 editor.js 中 scrollIntoView hack、code-lang-label DOM 注入、PreviewAPI 调用 - 清理 posts.css 中 ~200 行 wangEditor 样式覆盖(w-e-* 类名) - 清理 show.html 中 code-lang-label JS 注入(goldmark 自带 language-xxx class) - 更新 CSP 安全策略:移除 CodeMirror 注释,保留 esm.sh CDN - go.mod:bluemonday 和 goldmark 均保留为直接依赖(纵深防御)
This commit is contained in:
@ -48,18 +48,6 @@
|
||||
<script src="/static/js/common.js"></script>
|
||||
<script>
|
||||
(function() {
|
||||
// 代码块语言标签注入
|
||||
document.querySelectorAll('.post-detail-body pre').forEach(function(pre) {
|
||||
var code = pre.querySelector('code[class*="language-"]');
|
||||
if (!code) return;
|
||||
var match = code.className.match(/language-(\w+)/);
|
||||
if (!match) return;
|
||||
var label = document.createElement('span');
|
||||
label.className = 'code-lang-label';
|
||||
label.textContent = match[1];
|
||||
pre.insertBefore(label, pre.firstChild);
|
||||
});
|
||||
|
||||
var btn = document.getElementById('submitAuditBtn');
|
||||
if (!btn) return;
|
||||
btn.addEventListener('click', function() {
|
||||
|
||||
Reference in New Issue
Block a user