mirror of https://github.com/mindoc-org/mindoc.git
Merge pull request #731 from jh244212647/master
feature-mindmap: editor.md add mindmappull/733/head
commit
e0f6af036b
|
@ -170,6 +170,7 @@
|
||||||
flowChart : false, // flowChart.js only support IE9+
|
flowChart : false, // flowChart.js only support IE9+
|
||||||
sequenceDiagram : false, // sequenceDiagram.js only support IE9+
|
sequenceDiagram : false, // sequenceDiagram.js only support IE9+
|
||||||
mermaid : true,
|
mermaid : true,
|
||||||
|
mindMap : true, // 脑图
|
||||||
previewCodeHighlight : true,
|
previewCodeHighlight : true,
|
||||||
|
|
||||||
toolbar : true, // show/hide toolbar
|
toolbar : true, // show/hide toolbar
|
||||||
|
@ -569,6 +570,20 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings.mindMap)
|
||||||
|
{
|
||||||
|
editormd.loadScript(loadPath + "mindmap/transform.min", function() {
|
||||||
|
editormd.loadScript(loadPath + "mindmap/d3@5", function() {
|
||||||
|
editormd.loadScript(loadPath + "mindmap/view.min", function() {
|
||||||
|
if (!isLoadedDisplay){
|
||||||
|
isLoadedDisplay = true;
|
||||||
|
_this.loadedDisplay();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if(settings.sequenceDiagram) {
|
if(settings.sequenceDiagram) {
|
||||||
editormd.loadCSS(loadPath + "sequence/sequence-diagram-min", function () {
|
editormd.loadCSS(loadPath + "sequence/sequence-diagram-min", function () {
|
||||||
editormd.loadScript(loadPath + "sequence/webfont", function() {
|
editormd.loadScript(loadPath + "sequence/webfont", function() {
|
||||||
|
@ -1560,6 +1575,22 @@
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析思维导图 - 2020-04-12
|
||||||
|
*
|
||||||
|
* @returns {editormd} 返回editormd的实例对象
|
||||||
|
*/
|
||||||
|
mindmapRender:function(){
|
||||||
|
this.previewContainer.find(".mindmap").each(function(){
|
||||||
|
var mmap = $(this);
|
||||||
|
var md_data = window.markmap.transform(mmap.text().trim());
|
||||||
|
window.markmap.markmap("svg#"+this.id,md_data)
|
||||||
|
});
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析和渲染流程图及时序图
|
* 解析和渲染流程图及时序图
|
||||||
* FlowChart and SequenceDiagram Renderer
|
* FlowChart and SequenceDiagram Renderer
|
||||||
|
@ -2069,6 +2100,7 @@
|
||||||
sequenceDiagram : settings.sequenceDiagram,
|
sequenceDiagram : settings.sequenceDiagram,
|
||||||
previewCodeHighlight : settings.previewCodeHighlight,
|
previewCodeHighlight : settings.previewCodeHighlight,
|
||||||
mermaid : settings.mermaid,
|
mermaid : settings.mermaid,
|
||||||
|
mindMap : settings.mindMap, // 思维导图
|
||||||
};
|
};
|
||||||
|
|
||||||
var markedOptions = this.markedOptions = {
|
var markedOptions = this.markedOptions = {
|
||||||
|
@ -2150,6 +2182,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 渲染脑图
|
||||||
|
if(settings.mindMap){
|
||||||
|
setTimeout(function(){
|
||||||
|
_this.mindmapRender();
|
||||||
|
},10)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (settings.flowChart || settings.sequenceDiagram || settings.mermaid)
|
if (settings.flowChart || settings.sequenceDiagram || settings.mermaid)
|
||||||
{
|
{
|
||||||
flowchartTimer = setTimeout(function(){
|
flowchartTimer = setTimeout(function(){
|
||||||
|
@ -3539,7 +3579,7 @@
|
||||||
ext : ".png"
|
ext : ".png"
|
||||||
};
|
};
|
||||||
|
|
||||||
// Twitter Emoji (Twemoji) graphics files url path
|
// Twitter Emoji (Twemoji) graphics files url path
|
||||||
editormd.twemoji = {
|
editormd.twemoji = {
|
||||||
path : "http://twemoji.maxcdn.com/36x36/",
|
path : "http://twemoji.maxcdn.com/36x36/",
|
||||||
ext : ".png"
|
ext : ".png"
|
||||||
|
@ -3896,6 +3936,16 @@
|
||||||
{
|
{
|
||||||
return "<p class=\"" + editormd.classNames.tex + "\">" + code + "</p>";
|
return "<p class=\"" + editormd.classNames.tex + "\">" + code + "</p>";
|
||||||
}
|
}
|
||||||
|
else if (/^mindmap/i.test(lang)){
|
||||||
|
var len = 9 || 32;
|
||||||
|
var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
|
||||||
|
var maxPos = $chars.length;
|
||||||
|
var map_id = '';
|
||||||
|
for (var i = 0; i < len; i++) {
|
||||||
|
map_id += $chars.charAt(Math.floor(Math.random() * maxPos));
|
||||||
|
}
|
||||||
|
return "<svg class='mindmap' style='width:100%;min-height=150px;' id='mindmap-"+ map_id +"'>"+code+"</svg>";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -4183,6 +4233,7 @@
|
||||||
sequenceDiagram : false,
|
sequenceDiagram : false,
|
||||||
previewCodeHighlight : true,
|
previewCodeHighlight : true,
|
||||||
mermaid : true,
|
mermaid : true,
|
||||||
|
mindMap : true, //思维导图
|
||||||
};
|
};
|
||||||
|
|
||||||
editormd.$marked = marked;
|
editormd.$marked = marked;
|
||||||
|
@ -4213,6 +4264,7 @@
|
||||||
flowChart : settings.flowChart,
|
flowChart : settings.flowChart,
|
||||||
sequenceDiagram : settings.sequenceDiagram,
|
sequenceDiagram : settings.sequenceDiagram,
|
||||||
mermaid : settings.mermaid,
|
mermaid : settings.mermaid,
|
||||||
|
mindMap : settings.mindMap, // 思维导图
|
||||||
previewCodeHighlight : settings.previewCodeHighlight,
|
previewCodeHighlight : settings.previewCodeHighlight,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4307,6 +4359,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 前台渲染脑图
|
||||||
|
if(settings.mindMap){
|
||||||
|
var mindmapHandle = function(){
|
||||||
|
div.find(".mindmap").each(function(){
|
||||||
|
var mmap = $(this);
|
||||||
|
var md_data = window.markmap.transform(mmap.text().trim());
|
||||||
|
window.markmap.markmap("svg#"+this.id,md_data)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
mindmapHandle();
|
||||||
|
}
|
||||||
|
|
||||||
div.getMarkdown = function() {
|
div.getMarkdown = function() {
|
||||||
return saveTo.val();
|
return saveTo.val();
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue