From fe2e16d937e2b57fb2bb1d10dea47db7256a4a49 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Mon, 24 Mar 2025 01:08:07 +0000
Subject: [PATCH] fix: disallow user-select in popover
---
quartz/components/scripts/explorer.inline.ts | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/quartz/components/scripts/explorer.inline.ts b/quartz/components/scripts/explorer.inline.ts
index d1a74d6..b431c53 100644
--- a/quartz/components/scripts/explorer.inline.ts
+++ b/quartz/components/scripts/explorer.inline.ts
@@ -134,9 +134,9 @@
}
for (const child of node.children) {
- const childNode = child.data
- ? createFileNode(currentSlug, child)
- : createFolderNode(currentSlug, child, opts)
+ const childNode = child.isFolder
+ ? createFolderNode(currentSlug, child, opts)
+ : createFileNode(currentSlug, child)
ul.appendChild(childNode)
}
@@ -161,7 +161,7 @@
// Get folder state from local storage
const storageTree = localStorage.getItem("fileTree")
const serializedExplorerState = storageTree && opts.useSavedState ? JSON.parse(storageTree) : []
- const oldIndex = new Map(
+ const oldIndex = new Map<string, boolean>(
serializedExplorerState.map((entry: FolderState) => [entry.path, entry.collapsed]),
)
@@ -186,10 +186,14 @@
// Get folder paths for state management
const folderPaths = trie.getFolderPaths()
- currentExplorerState = folderPaths.map((path) => ({
- path,
- collapsed: oldIndex.get(path) === true,
- }))
+ currentExplorerState = folderPaths.map((path) => {
+ const previousState = oldIndex.get(path)
+ return {
+ path,
+ collapsed:
+ previousState === undefined ? opts.folderDefaultState === "collapsed" : previousState,
+ }
+ })
const explorerUl = explorer.querySelector(".explorer-ul")
if (!explorerUl) continue
--
Gitblit v1.10.0