mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
feat(share): allow viewing directories
This commit is contained in:
parent
0b3846fc35
commit
091ffdeb59
@ -12,16 +12,21 @@
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
export default function setupExpanders() {
|
export default function setupExpanders() {
|
||||||
const expanders = Array.from(document.querySelectorAll("#menu .submenu-item"));
|
const expanders = Array.from(document.querySelectorAll("#menu .submenu-item .collapse-button"));
|
||||||
for (const ex of expanders) {
|
for (const expander of expanders) {
|
||||||
ex.addEventListener("click", e => {
|
const li = expander.parentElement?.parentElement;
|
||||||
if ((e.target as Element).closest(".submenu-item,.item") !== ex) return;
|
if (!li) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
expander.addEventListener("click", e => {
|
||||||
|
if ((e.target as Element).closest(".submenu-item,.item") !== li) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const ul = ex.querySelector("ul")!;
|
const ul = li.querySelector("ul")!;
|
||||||
ul.style.height = `${ul.scrollHeight}px`;
|
ul.style.height = `${ul.scrollHeight}px`;
|
||||||
setTimeout(() => ex.classList.toggle("expanded"), 1);
|
setTimeout(() => li.classList.toggle("expanded"), 1);
|
||||||
setTimeout(() => ul.style.height = ``, 200);
|
setTimeout(() => ul.style.height = ``, 200);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user