Skip to content

Commit

Permalink
mindmap add custom-height setting
Browse files Browse the repository at this point in the history
用户可以通过在```mindmap后追加>number的格式设定思维导图的高度
例如```mindmap>600即设定整体思维导图高度为600px
  • Loading branch information
Gogs authored and zhangsheng15 committed Oct 8, 2021
1 parent 32a9f97 commit 65cd6b9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
21 changes: 14 additions & 7 deletions static/editor.md/editormd.js
Original file line number Diff line number Diff line change
Expand Up @@ -3934,14 +3934,21 @@
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));
var len = 9 || 32;
var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
var maxPos = $chars.length;
var map_id = '';
var custom_height;
var h = lang.split('>')[1];
if (h != undefined) {
custom_height = h;
} else {
custom_height = 150;
}
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>";
return "<svg class='mindmap' style='width:100%;min-height=150px;height:"+custom_height+"px;' id='mindmap-"+ map_id +"'>"+code+"</svg>";
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion static/editor.md/editormd.min.js

Large diffs are not rendered by default.

0 comments on commit 65cd6b9

Please sign in to comment.