mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-02 23:08:14 +00:00
fix: use slugs instead of title as basis for explorer (#652)
* use slugs instead of title as basis for explorer * fix folder persist state, better default behaviour * use relative path instead of full path as full path is affected by -d * dont use title in breadcrumb if it's just index lol
This commit is contained in:
parent
63bf1e14b5
commit
504b447162
7 changed files with 110 additions and 90 deletions
quartz/components/scripts
|
@ -59,8 +59,7 @@ function toggleFolder(evt: MouseEvent) {
|
|||
// Save folder state to localStorage
|
||||
const clickFolderPath = currentFolderParent.dataset.folderpath as string
|
||||
|
||||
// Remove leading "/"
|
||||
const fullFolderPath = clickFolderPath.substring(1)
|
||||
const fullFolderPath = clickFolderPath
|
||||
toggleCollapsedByPath(explorerState, fullFolderPath)
|
||||
|
||||
const stringifiedFileTree = JSON.stringify(explorerState)
|
||||
|
@ -108,9 +107,7 @@ function setupExplorer() {
|
|||
explorerState = JSON.parse(storageTree)
|
||||
explorerState.map((folderUl) => {
|
||||
// grab <li> element for matching folder path
|
||||
const folderLi = document.querySelector(
|
||||
`[data-folderpath='/${folderUl.path}']`,
|
||||
) as HTMLElement
|
||||
const folderLi = document.querySelector(`[data-folderpath='${folderUl.path}']`) as HTMLElement
|
||||
|
||||
// Get corresponding content <ul> tag and set state
|
||||
if (folderLi) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue