mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-06-28 15:45:35 +08:00
mindmap add custom-height setting
用户可以通过在```mindmap后追加>number的格式设定思维导图的高度 例如```mindmap>600即设定整体思维导图高度为600px
This commit is contained in:
parent
32a9f979a0
commit
65cd6b96b8
@ -3934,14 +3934,21 @@
|
|||||||
return "<p class=\"" + editormd.classNames.tex + "\">" + code + "</p>";
|
return "<p class=\"" + editormd.classNames.tex + "\">" + code + "</p>";
|
||||||
}
|
}
|
||||||
else if (/^mindmap/i.test(lang)){
|
else if (/^mindmap/i.test(lang)){
|
||||||
var len = 9 || 32;
|
var len = 9 || 32;
|
||||||
var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
|
var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
|
||||||
var maxPos = $chars.length;
|
var maxPos = $chars.length;
|
||||||
var map_id = '';
|
var map_id = '';
|
||||||
for (var i = 0; i < len; i++) {
|
var custom_height;
|
||||||
map_id += $chars.charAt(Math.floor(Math.random() * maxPos));
|
var h = lang.split('>')[1];
|
||||||
|
if (h != undefined) {
|
||||||
|
custom_height = h;
|
||||||
|
} else {
|
||||||
|
custom_height = 150;
|
||||||
}
|
}
|
||||||
return "<svg class='mindmap' style='width:100%;min-height=150px;' id='mindmap-"+ map_id +"'>"+code+"</svg>";
|
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;height:"+custom_height+"px;' id='mindmap-"+ map_id +"'>"+code+"</svg>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
2
static/editor.md/editormd.min.js
vendored
2
static/editor.md/editormd.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user