mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-25 15:58:55 +00:00
🐛 Fix: toc-auto display error (#21)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
- :tada: Feat: add PWA support
|
||||
- :bug: Fix: add scroll-margin to headerlink
|
||||
- :bug: Fix: Check if content is empty beforing passing
|
||||
- :bug: Fix: toc-auto display error ([#21](https://github.com/Lruihao/FixIt/issues/21))
|
||||
- :fire: Feat: remove lib smooth-scroll ([#1](https://github.com/Lruihao/FixIt/issues/1))
|
||||
- :lipstick: Style: change scroll-behavior to smooth
|
||||
- :lipstick: Style: page image margin
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+8
-2
@@ -396,7 +396,14 @@ class Theme {
|
||||
|
||||
initToc() {
|
||||
const $tocCore = document.getElementById('TableOfContents');
|
||||
if ($tocCore === null) return;
|
||||
if ($tocCore === null){
|
||||
return;
|
||||
}
|
||||
const $toc = document.getElementById('toc-auto');
|
||||
if ($tocCore.innerText === ''){
|
||||
$toc.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
if (document.getElementById('toc-static').getAttribute('kept') || this.util.isTocStatic()) {
|
||||
const $tocContentStatic = document.getElementById('toc-content-static');
|
||||
if ($tocCore.parentElement !== $tocContentStatic) {
|
||||
@@ -410,7 +417,6 @@ class Theme {
|
||||
$tocCore.parentElement.removeChild($tocCore);
|
||||
$tocContentAuto.appendChild($tocCore);
|
||||
}
|
||||
const $toc = document.getElementById('toc-auto');
|
||||
const $page = document.getElementsByClassName('page')[0];
|
||||
const rect = $page.getBoundingClientRect();
|
||||
$toc.style.left = `${rect.left + rect.width + 20}px`;
|
||||
|
||||
Reference in New Issue
Block a user