优化editormd编辑器添加思维导图示例

This commit is contained in:
yangjian 2023-08-23 08:56:10 +08:00
parent 0f93f91ac7
commit 5b0655e4c4

View File

@ -168,9 +168,12 @@
},
// 添加思维导图
mindmap:function(cm,icon,cursor,selection){
cm.replaceSelection('```mindmap\n' + selection + "\n```");
if(selection === "") {
let mindmap_example = "# 主题\n### 一级主题1\n### 一级主题2\n### 一级主题3"
cm.replaceSelection('```mindmap\n' + mindmap_example + "\n```");
cm.setCursor(cursor.line+1, cursor.ch);
}else{
cm.replaceSelection('```mindmap\n' + selection + "\n```");
}
},
// 添加echart图