fix: 双击标题栏最大化 + Monaco用官方默认主题

1. 双击编辑器标题栏空白区域 → 切换最大化/还原
2. Monaco移除theme:'vs-dark'和fontFamily覆盖, 使用官方默认配置
3. 编辑器外观与 https://microsoft.github.io/monaco-editor 一致
This commit is contained in:
Your Name
2026-05-31 02:35:52 +08:00
parent c570801119
commit ae47eb42de
+6 -12
View File
@@ -654,28 +654,17 @@
if(window._monacoReady){
tab.editor=monaco.editor.create(container,{
value:content,language:lang,
theme:'vs-dark', // 匹配 Nexus 暗色主题(官方默认 'vs' 亮色)
// 官方默认配置 — 不匹配项目主题
automaticLayout:true,
// 行号 + 折叠 (官方默认: lineNumbers='on', folding=true)
lineNumbers:'on',folding:true,
// 括号匹配 (官方默认: matchBrackets='always', bracketPairColorization=true)
bracketPairColorization:{enabled:true},matchBrackets:'always',
// 光标 (官方默认: cursorBlinking='blink', cursorStyle='line')
cursorBlinking:'blink',cursorStyle:'line',
// 字体 (官方默认: fontSize=0即14, 无lineHeight/padding)
fontSize:14,
fontFamily:"'Cascadia Code','Fira Code','JetBrains Mono',Menlo,Monaco,'Courier New',monospace",
// 换行 (官方默认: wordWrap='off')
wordWrap:'off',
// 小地图 (官方默认: enabled=true)
minimap:{enabled:true},
// 滚动 (官方默认: scrollBeyondLastLine=true)
scrollBeyondLastLine:true,
// 补全 (官方默认: suggestOnTriggerCharacters=true)
suggestOnTriggerCharacters:true,
// 缩进 (官方默认: tabSize=4)
tabSize:4,
// 其他官方默认行为
renderWhitespace:'none',
links:true,colorDecorators:true,
});
@@ -845,6 +834,11 @@
e.preventDefault();
}
header.addEventListener('mousedown',startDrag);
// Double-click header to toggle maximize
header.addEventListener('dblclick',e=>{
if(e.target.closest('button')||e.target.closest('input')||e.target.closest('select'))return;
toggleEditorSize();
});
document.addEventListener('mousemove',e=>{
if(!dragging)return;
const x=Math.max(0,Math.min(window.innerWidth-100,startLeft+e.clientX-startX));