diff --git a/frontend/index.html b/frontend/index.html index ee6f1cc..be93ce1 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -246,7 +246,6 @@ body{font-family:var(--sans);background:var(--bg);color:var(--text);font-size:14
加载中…
- @@ -319,9 +318,11 @@ function init(){ loadLatexChips(); // LaTeX 常用公式合集(按学科) latexLive(); // 预览区默认示例 } -/* ================= 编辑器:Monaco(CDN)优先,CodeMirror 回退 ================= */ +/* ================= 编辑器:Monaco(动态注入,避免与 CodeMirror mode 的 AMD 分支冲突)优先,CodeMirror 回退 ================= */ function initEditor(){ - if(window.require && document.getElementById('cmWrap')){ + var s=document.createElement('script'); + s.src='/vendor/monaco/min/vs/loader.js'; + s.onload=function(){ try{ window.require.config({paths:{vs:'/vendor/monaco/min/vs'}}); var t=setTimeout(function(){ if(!MONACO_BOOTED) bootCodeMirror(); },6000); @@ -330,7 +331,9 @@ function initEditor(){ try{ bootMonaco(); }catch(e){ bootCodeMirror(); } }, function(){ clearTimeout(t); bootCodeMirror(); }); }catch(e){ bootCodeMirror(); } - } else bootCodeMirror(); + }; + s.onerror=function(){ bootCodeMirror(); }; + document.head.appendChild(s); } function bootCodeMirror(){ CM = CodeMirror(document.getElementById('cmWrap'), {