Skip to content

Commit 6792c82

Browse files
committed
Merge branch 'issuse'
2 parents 5f468a4 + 0c0bb26 commit 6792c82

File tree

2 files changed

+38
-10
lines changed

2 files changed

+38
-10
lines changed

static/css/markdown.preview.css

+19-6
Original file line numberDiff line numberDiff line change
@@ -51,30 +51,43 @@
5151
width: 100%;
5252
}
5353

54+
.whole-article-wrap {
55+
display: flex;
56+
flex-direction: column;
57+
}
58+
5459
.article-body .markdown-toc{
5560
position: fixed;
56-
right: 0;
61+
right: 50px;
5762
width: 260px;
5863
font-size: 12px;
59-
margin-top: -70px;
6064
overflow: auto;
61-
margin-right: 50px;
65+
border: 1px solid #e8e8e8;
66+
border-radius: 6px;
6267
}
6368
.markdown-toc ul{
6469
list-style:none;
6570
}
71+
72+
.markdown-toc-list {
73+
padding:20px 0 !important;
74+
margin-bottom: 0 !important;
75+
}
76+
6677
.markdown-toc .markdown-toc-list>li{
6778
padding: 3px 10px 3px 16px;
6879
line-height: 18px;
69-
border-left: 2px solid #e8e8e8;
80+
/*border-left: 2px solid #e8e8e8;*/
7081
color: #595959;
82+
margin-left: -2px;
7183
}
7284
.markdown-toc .markdown-toc-list>li.active{
7385
border-right: 2px solid #25b864;
7486
}
7587

7688
.article-body .markdown-article{
77-
margin-right: 250px;
89+
width: calc(100% - 260px);
90+
/*margin-right: 250px;*/
7891
}
7992
.article-body.content .markdown-toc{
8093
position: relative;
@@ -87,7 +100,7 @@
87100
.markdown-toc-list .directory-item {
88101
padding: 3px 10px 3px 16px;
89102
line-height: 18px;
90-
border-left: 2px solid #e8e8e8;
103+
/*border-left: 2px solid #e8e8e8;*/
91104
color: #595959;
92105
}
93106
.markdown-toc-list .directory-item-link {

static/js/kancloud.js

+19-4
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,7 @@ function renderPage($data) {
143143
$("#doc_id").val($data.doc_id);
144144
if ($data.page) {
145145
loadComment($data.page, $data.doc_id);
146-
147-
}
148-
else {
146+
} else {
149147
pageClicked(-1, $data.doc_id);
150148
}
151149

@@ -156,6 +154,7 @@ function renderPage($data) {
156154
$("#view_container").removeClass("theme__dark theme__green theme__light theme__red theme__default")
157155
$("#view_container").addClass($data.markdown_theme)
158156
}
157+
checkMarkdownTocElement();
159158
}
160159

161160
/***
@@ -230,6 +229,7 @@ function initHighlighting() {
230229
}
231230

232231
$(function () {
232+
checkMarkdownTocElement();
233233
$(".view-backtop").on("click", function () {
234234
$('.manual-right').animate({ scrollTop: '0px' }, 200);
235235
});
@@ -280,7 +280,7 @@ $(function () {
280280

281281

282282
$(window).resize(function (e) {
283-
var h = $(".manual-catalog").innerHeight() - 20;
283+
var h = $(".manual-catalog").innerHeight() - 50;
284284
$(".markdown-toc").height(h);
285285
}).resize();
286286

@@ -417,4 +417,19 @@ function loadCopySnippets() {
417417
[].forEach.call(snippets, function (snippet) {
418418
Prism.highlightElement(snippet);
419419
});
420+
}
421+
422+
function checkMarkdownTocElement() {
423+
console.log(111)
424+
let toc = $(".markdown-toc-list");
425+
let articleComment = $("#articleComment");
426+
if (toc.length) {
427+
$(".wiki-bottom-left").css("width", "calc(100% - 260px)");
428+
articleComment.css("width", "calc(100% - 260px)");
429+
articleComment.css("margin", "30px 0 70px 0");
430+
} else {
431+
$(".wiki-bottom-left").css("width", "100%");
432+
articleComment.css("width", "100%");
433+
articleComment.css("margin", "30px auto 70px auto;");
434+
}
420435
}

0 commit comments

Comments
 (0)