Skip to content

Commit

Permalink
Merge branch 'issuse'
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzhenping committed Jul 5, 2024
2 parents 5f468a4 + 0c0bb26 commit 6792c82
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 10 deletions.
25 changes: 19 additions & 6 deletions static/css/markdown.preview.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,43 @@
width: 100%;
}

.whole-article-wrap {
display: flex;
flex-direction: column;
}

.article-body .markdown-toc{
position: fixed;
right: 0;
right: 50px;
width: 260px;
font-size: 12px;
margin-top: -70px;
overflow: auto;
margin-right: 50px;
border: 1px solid #e8e8e8;
border-radius: 6px;
}
.markdown-toc ul{
list-style:none;
}

.markdown-toc-list {
padding:20px 0 !important;
margin-bottom: 0 !important;
}

.markdown-toc .markdown-toc-list>li{
padding: 3px 10px 3px 16px;
line-height: 18px;
border-left: 2px solid #e8e8e8;
/*border-left: 2px solid #e8e8e8;*/
color: #595959;
margin-left: -2px;
}
.markdown-toc .markdown-toc-list>li.active{
border-right: 2px solid #25b864;
}

.article-body .markdown-article{
margin-right: 250px;
width: calc(100% - 260px);
/*margin-right: 250px;*/
}
.article-body.content .markdown-toc{
position: relative;
Expand All @@ -87,7 +100,7 @@
.markdown-toc-list .directory-item {
padding: 3px 10px 3px 16px;
line-height: 18px;
border-left: 2px solid #e8e8e8;
/*border-left: 2px solid #e8e8e8;*/
color: #595959;
}
.markdown-toc-list .directory-item-link {
Expand Down
23 changes: 19 additions & 4 deletions static/js/kancloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ function renderPage($data) {
$("#doc_id").val($data.doc_id);
if ($data.page) {
loadComment($data.page, $data.doc_id);

}
else {
} else {
pageClicked(-1, $data.doc_id);
}

Expand All @@ -156,6 +154,7 @@ function renderPage($data) {
$("#view_container").removeClass("theme__dark theme__green theme__light theme__red theme__default")
$("#view_container").addClass($data.markdown_theme)
}
checkMarkdownTocElement();
}

/***
Expand Down Expand Up @@ -230,6 +229,7 @@ function initHighlighting() {
}

$(function () {
checkMarkdownTocElement();
$(".view-backtop").on("click", function () {
$('.manual-right').animate({ scrollTop: '0px' }, 200);
});
Expand Down Expand Up @@ -280,7 +280,7 @@ $(function () {


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

Expand Down Expand Up @@ -417,4 +417,19 @@ function loadCopySnippets() {
[].forEach.call(snippets, function (snippet) {
Prism.highlightElement(snippet);
});
}

function checkMarkdownTocElement() {
console.log(111)
let toc = $(".markdown-toc-list");
let articleComment = $("#articleComment");
if (toc.length) {
$(".wiki-bottom-left").css("width", "calc(100% - 260px)");
articleComment.css("width", "calc(100% - 260px)");
articleComment.css("margin", "30px 0 70px 0");
} else {
$(".wiki-bottom-left").css("width", "100%");
articleComment.css("width", "100%");
articleComment.css("margin", "30px auto 70px auto;");
}
}

0 comments on commit 6792c82

Please sign in to comment.