From 18ced19d6fef82860286e77dcdaa18a4bde2f0f4 Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Thu, 3 Feb 2022 12:58:14 +0800 Subject: [PATCH] =?UTF-8?q?MD=E7=BC=96=E8=BE=91=E5=99=A8=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../template/js/note/noteEditMarkDown.js | 4 +++ .../template/tpl/note/noteEditMarkDown.html | 33 +++++++++++++++++++ .../assets/lib/editormd/js/editormd.js | 21 +++++++++--- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/note/src/main/resources/template/js/note/noteEditMarkDown.js b/note/src/main/resources/template/js/note/noteEditMarkDown.js index 1c6462d65..39e437a41 100644 --- a/note/src/main/resources/template/js/note/noteEditMarkDown.js +++ b/note/src/main/resources/template/js/note/noteEditMarkDown.js @@ -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'); } diff --git a/note/src/main/resources/template/tpl/note/noteEditMarkDown.html b/note/src/main/resources/template/tpl/note/noteEditMarkDown.html index 4384409e3..f51544605 100644 --- a/note/src/main/resources/template/tpl/note/noteEditMarkDown.html +++ b/note/src/main/resources/template/tpl/note/noteEditMarkDown.html @@ -8,11 +8,44 @@ +
+ +
+
+ 目录 +
+
+
diff --git a/web/src/main/resources/template/assets/lib/editormd/js/editormd.js b/web/src/main/resources/template/assets/lib/editormd/js/editormd.js index 42d1436c7..58d81ab4b 100644 --- a/web/src/main/resources/template/assets/lib/editormd/js/editormd.js +++ b/web/src/main/resources/template/assets/lib/editormd/js/editormd.js @@ -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(); + } } }; -- GitLab