🐛 Fix: toc empty error

This commit is contained in:
Cell
2022-03-01 22:11:39 +08:00
parent f7844fd0d9
commit aa6d6db424
4 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -55,7 +55,7 @@
padding-right: 1rem;
@include overflow-wrap(break-word);
box-sizing: border-box;
visibility: hidden;
visibility: hidden; // TODO use animateCSS instead
@include blur;
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+5 -4
View File
@@ -487,11 +487,10 @@ class Theme {
}
initToc() {
const $toc = document.getElementById('toc-auto');
if ($toc === null) {
const $tocCore = document.getElementById('TableOfContents');
if ($tocCore === null) {
return;
}
const $tocCore = document.getElementById('TableOfContents');
if (
document.getElementById('toc-static').getAttribute('kept') === 'true' ||
this.util.isTocStatic()
@@ -508,7 +507,8 @@ class Theme {
$tocCore.parentElement.removeChild($tocCore);
$tocContentAuto.appendChild($tocCore);
}
$toc.style.visibility = 'visible';
const $toc = document.getElementById('toc-auto');
$toc.style.visibility = 'visible'; // TODO use animateCSS instead
$toc.style.marginTop =
document.querySelector('.single-title').clientHeight +
document.querySelector('.post-meta').clientHeight +
@@ -947,6 +947,7 @@ class Theme {
this._resizeTimeout = window.setTimeout(() => {
this._resizeTimeout = null;
for (let event of this.resizeEventSet) event();
this.initToc();
this.initMermaid();
this.initSearch();
}, 100);