提交 18ced19d 编写于 作者: doc_wei's avatar doc_wei

MD编辑器新增目录

上级 703dd147
......@@ -49,6 +49,10 @@ layui.config({
onchange : function (){
if(!initFirst){
initFirst = true;
layEditor.config({
tocContainer : "#custom-toc-container",
tocDropdown : false
});
}else{
parent.$("#editMyNote").addClass('select');
}
......
......@@ -8,11 +8,44 @@
<link href="../../assets/lib/editormd/css/editormd.css" rel="stylesheet" />
<!-- 页面解析markdown为HTML显示需要的css -->
<link href="../../assets/lib/editormd/css/editormd.preview.min.css"rel="stylesheet" />
<style type="text/css">
.show-folder{
position: absolute;
top: 120px;
right: 0px;
z-index: 999;
background-color: #FFFFFF;
width: 170px;
height: 400px;
border: 1px solid gainsboro;
}
.show-folder .title{
height: 40px;
line-height: 40px;
background-color: gainsboro;
padding-left: 10px;
}
.show-folder #custom-toc-container{
padding: 0px;
overflow-x: auto;
white-space: nowrap;
height: calc(100% - 40px);
}
</style>
</head>
<body>
<div class="file-console">
<div id="content"></div>
</div>
<div class="show-folder" id="markdownFolder">
<div class="title">
<font>目录</font>
</div>
<div class="markdown-body editormd-preview-container" id="custom-toc-container"></div>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
......
......@@ -61,7 +61,7 @@ layui.define(["jquery"], function(exports) {
"h1", "h2", "h3", "h4", "h5", "h6", "|",
"list-ul", "list-ol", "hr", "|",
"link", "reference-link", "image", "code", "preformatted-text", "code-block", "table", "datetime", "emoji", "html-entities", "pagebreak", "|",
"goto-line", "watch", "preview", "fullscreen", "clear", "search"
"goto-line", "watch", "preview", "fullscreen", "clear", "search", "catalogue"
],
simple : [
"undo", "redo", "|",
......@@ -132,6 +132,7 @@ layui.define(["jquery"], function(exports) {
onfullscreenExit : function() {},
onscroll : function() {},
onpreviewscroll : function() {},
catalogue : function() {},
imageUpload : false,
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
......@@ -210,7 +211,8 @@ layui.define(["jquery"], function(exports) {
fullscreen : "fa-arrows-alt",
clear : "fa-eraser",
help : "fa-question-circle",
info : "fa-info-circle"
info : "fa-info-circle",
catalogue : "fa-list"
},
toolbarIconTexts : {},
......@@ -256,7 +258,8 @@ layui.define(["jquery"], function(exports) {
clear : "清空",
search : "搜索",
help : "使用帮助",
info : "关于" + editormd.title
info : "关于" + editormd.title,
catalogue : "目录"
},
buttons : {
enter : "确定",
......@@ -1425,9 +1428,9 @@ layui.define(["jquery"], function(exports) {
var _this = this;
var editor = this.editor;
var settings = this.settings;
this.codeMirror.remove();
this.setCodeMirror();
if (!settings.readOnly)
......@@ -3167,6 +3170,14 @@ layui.define(["jquery"], function(exports) {
info : function() {
this.showInfoDialog();
},
catalogue: function (){
if($("#markdownFolder").is(':hidden')){
$("#markdownFolder").show();
}else{
$("#markdownFolder").hide();
}
}
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册