mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-05-18 14:34:23 +02:00
add highlight class
This commit is contained in:
parent
50efa14bd2
commit
2802aa91f4
@ -167,6 +167,9 @@ You can also add the equivalent of a `beforeunload` event for [[SPA Routing]] vi
|
|||||||
document.addEventListener("prenav", () => {
|
document.addEventListener("prenav", () => {
|
||||||
// executed after an SPA navigation is triggered but
|
// executed after an SPA navigation is triggered but
|
||||||
// before the page is replaced
|
// before the page is replaced
|
||||||
|
// one usage pattern is to store things in sessionStorage
|
||||||
|
// in the prenav and then conditionally load then in the consequent
|
||||||
|
// nav
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ export interface Options {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaultOptions: Options = {
|
const defaultOptions: Options = {
|
||||||
folderClickBehavior: "collapse",
|
|
||||||
folderDefaultState: "collapsed",
|
folderDefaultState: "collapsed",
|
||||||
|
folderClickBehavior: "collapse",
|
||||||
useSavedState: true,
|
useSavedState: true,
|
||||||
mapFn: (node) => {
|
mapFn: (node) => {
|
||||||
return node
|
return node
|
||||||
|
@ -81,6 +81,11 @@ function createFileNode(currentSlug: FullSlug, node: FileTrieNode): HTMLLIElemen
|
|||||||
a.href = resolveRelative(currentSlug, node.data?.slug!)
|
a.href = resolveRelative(currentSlug, node.data?.slug!)
|
||||||
a.dataset.for = node.data?.slug
|
a.dataset.for = node.data?.slug
|
||||||
a.textContent = node.displayName
|
a.textContent = node.displayName
|
||||||
|
|
||||||
|
if (currentSlug === node.data?.slug) {
|
||||||
|
a.classList.add("active")
|
||||||
|
}
|
||||||
|
|
||||||
return li
|
return li
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,10 +62,9 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
button#mobile-explorer,
|
button#mobile-explorer,
|
||||||
button#desktop-explorer {
|
button#desktop-explorer {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
@ -90,19 +89,25 @@ button#desktop-explorer {
|
|||||||
.explorer.collapsed > & .fold {
|
.explorer.collapsed > & .fold {
|
||||||
transform: rotateZ(-90deg);
|
transform: rotateZ(-90deg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
pointer-events: all;
|
||||||
|
|
||||||
|
& > polyline {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#explorer-content {
|
#explorer-content {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
max-height: 100%;
|
|
||||||
transition: max-height 0.35s ease;
|
|
||||||
margin-top: 0.5rem;
|
margin-top: 0.5rem;
|
||||||
|
|
||||||
.explorer.collapsed > & {
|
.explorer.collapsed > & > ul.overflow {
|
||||||
max-height: 0px;
|
max-height: 0px;
|
||||||
transition: max-height 0.35s ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
& ul {
|
& ul {
|
||||||
@ -111,18 +116,18 @@ button#desktop-explorer {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
transition:
|
transition:
|
||||||
max-height 0.35s ease,
|
max-height 0.35s ease,
|
||||||
transform 0.35s ease,
|
transform 0.35s ease;
|
||||||
opacity 0.2s ease;
|
|
||||||
|
|
||||||
& li > a {
|
& li > a {
|
||||||
color: var(--dark);
|
color: var(--dark);
|
||||||
opacity: 0.75;
|
opacity: 0.75;
|
||||||
pointer-events: all;
|
pointer-events: all;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
> #explorer-ul {
|
&.active {
|
||||||
max-height: none;
|
opacity: 1;
|
||||||
|
color: var(--tertiary);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.folder-outer {
|
.folder-outer {
|
||||||
@ -143,14 +148,6 @@ button#desktop-explorer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
svg {
|
|
||||||
pointer-events: all;
|
|
||||||
|
|
||||||
& > polyline {
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.folder-container {
|
.folder-container {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user