1、增加文档目录列表展开、收起功能

2、编辑完成返回按钮,回到编辑前界面
pull/663/head
wangbin05 2021-03-24 09:40:27 +08:00
parent 31cb464dc2
commit f616985036
2 changed files with 43 additions and 1 deletions

View File

@ -88,6 +88,10 @@
<div class="tab-navg">
<span data-mode="view" class="navg-item active"><i class="fa fa-align-justify"></i><b class="text">目录</b></span>
<span data-mode="search" class="navg-item"><i class="fa fa-search"></i><b class="text">搜索</b></span>
<span id="handlerMenuShow" style="float: right;display: inline-block;padding: 5px;cursor: pointer;">
<i class="fa fa-angle-left" style="font-size: 20px;padding-right: 5px;"></i>
<span class="pull-right" style="padding-top: 4px;">展开</span>
</span>
</div>
<div class="tab-util">
<span class="manual-fullscreen-switch">
@ -290,6 +294,43 @@ $(function () {
return $(body).highlight(window.keyword);
});
});
window.menuControl = true;
window.menuSetting = "open" ;
if (menuSetting == 'open' || menuSetting == 'first') {
$('#handlerMenuShow').find('span').text('收起');
$('#handlerMenuShow').find('i').attr("class","fa fa-angle-down");
if (menuSetting == 'open') {
window.jsTree.jstree().open_all()
}
if (menuSetting == 'first') {
window.jsTree.jstree('close_all')
var $target = $('.jstree-container-ul').children('li').filter(function(index){
if($(this).attr('aria-expanded')==false||$(this).attr('aria-expanded')){
return $(this)
}else{
delete $(this)
}
})
$target.children('i').trigger('click')
}
} else {
menuControl = false;
window.jsTree.jstree('close_all')
}
$('#handlerMenuShow').on('click', function(){
if(menuControl){
$(this).find('span').text('展开')
$(this).find('i').attr("class","fa fa-angle-left")
window.menuControl = false
window.jsTree.jstree('close_all')
}else{
window.menuControl = true
$(this).find('span').text('收起')
$(this).find('i').attr("class","fa fa-angle-down")
window.jsTree.jstree().open_all()
}
})
});
</script>
{{.Scripts}}

View File

@ -56,7 +56,8 @@
<div class="m-manual manual-editor">
<div class="manual-head" id="editormd-tools" style="min-width: 1200px; position:absolute;">
<div class="editormd-group">
<a href="{{urlfor "BookController.Index"}}" data-toggle="tooltip" data-title="返回"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>
<!--a href="{{urlfor "BookController.Index"}}" data-toggle="tooltip" data-title="返回"><i class="fa fa-chevron-left" aria-hidden="true"></i></a-->
<a href="javascript:" onclick="self.location=document.referrer;" data-toggle="tooltip" data-title="返回"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>
</div>
<div class="editormd-group">
<a href="javascript:;" id="markdown-save" data-toggle="tooltip" data-title="保存" class="disabled save"><i class="fa fa-save first" aria-hidden="true" name="save"></i></a>