mirror of
https://github.com/zadam/trilium.git
synced 2025-09-29 18:15:39 +08:00
feat(share): allow viewing directories
This commit is contained in:
parent
0b3846fc35
commit
091ffdeb59
1 changed files with 12 additions and 7 deletions
|
@ -12,16 +12,21 @@
|
|||
// }
|
||||
|
||||
export default function setupExpanders() {
|
||||
const expanders = Array.from(document.querySelectorAll("#menu .submenu-item"));
|
||||
for (const ex of expanders) {
|
||||
ex.addEventListener("click", e => {
|
||||
if ((e.target as Element).closest(".submenu-item,.item") !== ex) return;
|
||||
const expanders = Array.from(document.querySelectorAll("#menu .submenu-item .collapse-button"));
|
||||
for (const expander of expanders) {
|
||||
const li = expander.parentElement?.parentElement;
|
||||
if (!li) {
|
||||
continue;
|
||||
}
|
||||
|
||||
expander.addEventListener("click", e => {
|
||||
if ((e.target as Element).closest(".submenu-item,.item") !== li) return;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const ul = ex.querySelector("ul")!;
|
||||
const ul = li.querySelector("ul")!;
|
||||
ul.style.height = `${ul.scrollHeight}px`;
|
||||
setTimeout(() => ex.classList.toggle("expanded"), 1);
|
||||
setTimeout(() => li.classList.toggle("expanded"), 1);
|
||||
setTimeout(() => ul.style.height = ``, 200);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue