fix(toc): Use data attributes for toc
Partially fixes: #401 Signed-off-by: Khusika Dhamar Gusti <mail@khusika.com>
This commit is contained in:
@@ -116,7 +116,7 @@
|
|||||||
display: none;
|
display: none;
|
||||||
margin: .8rem 0;
|
margin: .8rem 0;
|
||||||
|
|
||||||
&[kept=true] {
|
&[data-kept=true] {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
assets/js/theme.min.js
vendored
2
assets/js/theme.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -76,7 +76,7 @@
|
|||||||
|
|
||||||
{{- /* Static TOC */ -}}
|
{{- /* Static TOC */ -}}
|
||||||
{{- if ne $toc.enable false -}}
|
{{- if ne $toc.enable false -}}
|
||||||
<div class="details toc" id="toc-static" kept="{{ if $toc.keepStatic }}true{{ end }}">
|
<div class="details toc" id="toc-static" data-kept="{{ if $toc.keepStatic }}true{{ end }}">
|
||||||
<div class="details-summary toc-title">
|
<div class="details-summary toc-title">
|
||||||
<span>{{ T "contents" }}</span>
|
<span>{{ T "contents" }}</span>
|
||||||
<span><i class="details-icon fas fa-angle-right"></i></span>
|
<span><i class="details-icon fas fa-angle-right"></i></span>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -397,7 +397,7 @@ class Theme {
|
|||||||
initToc() {
|
initToc() {
|
||||||
const $tocCore = document.getElementById('TableOfContents');
|
const $tocCore = document.getElementById('TableOfContents');
|
||||||
if ($tocCore === null) return;
|
if ($tocCore === null) return;
|
||||||
if (document.getElementById('toc-static').getAttribute('kept') || this.util.isTocStatic()) {
|
if (document.getElementById('toc-static').getAttribute('data-kept') || this.util.isTocStatic()) {
|
||||||
const $tocContentStatic = document.getElementById('toc-content-static');
|
const $tocContentStatic = document.getElementById('toc-content-static');
|
||||||
if ($tocCore.parentElement !== $tocContentStatic) {
|
if ($tocCore.parentElement !== $tocContentStatic) {
|
||||||
$tocCore.parentElement.removeChild($tocCore);
|
$tocCore.parentElement.removeChild($tocCore);
|
||||||
|
|||||||
Reference in New Issue
Block a user