feat(demo): add Mermaid.js CDN for diagram rendering in demo page
- Load mermaid@10 from jsdelivr CDN (library remains zero-dependency) - Auto-render on afterRender event + initial timeout - mermaid.run() targets .me-mermaid .mermaid containers
This commit is contained in:
@@ -97,6 +97,7 @@ body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Micr
|
||||
<a href="https://git.metona.cn/MetonaTeam/MetonaEditor" target="_blank" rel="noopener">源码仓库</a> · MIT
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
|
||||
<script src="../dist/metona-editor.js"></script>
|
||||
<script>
|
||||
(function(){
|
||||
@@ -262,6 +263,15 @@ editor.on('fileOpened',function(d){editor.toast('已打开: '+d.name,{type:'succ
|
||||
editor.on('fileSaved',function(){editor.toast('文件已保存',{type:'success'})});
|
||||
editor.on('linkClick',function(d){editor.toast('链接点击: '+d.href,{type:'info',duration:1500})});
|
||||
|
||||
// Mermaid 图表渲染(v0.1.14)
|
||||
function renderMermaid(){
|
||||
if(typeof mermaid==='undefined')return;
|
||||
try{mermaid.run({querySelector:'.me-mermaid .mermaid'})}catch(e){}
|
||||
}
|
||||
mermaid.initialize({startOnLoad:false,theme:'default'});
|
||||
editor.on('afterRender',renderMermaid);
|
||||
setTimeout(renderMermaid,300);
|
||||
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user