mindmap add custom-height setting

用户可以通过在```mindmap后追加>number的格式设定思维导图的高度
例如```mindmap>600即设定整体思维导图高度为600px
This commit is contained in:
Gogs 2021-10-03 11:56:22 +08:00 committed by zhangsheng15
parent 32a9f979a0
commit 65cd6b96b8
2 changed files with 15 additions and 8 deletions

View File

@ -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;
}
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
{

File diff suppressed because one or more lines are too long