Vanessa 2025-02-09 13:33:14 +08:00
parent 8dc6420bee
commit 1da6bd10dd
2 changed files with 31 additions and 2 deletions

View file

@ -777,7 +777,7 @@ export class Files extends Model {
currentPath = dirname + ".sy";
}
} else {
liElement.querySelector("fn__hidden").classList.remove("fn__hidden");
liElement.querySelector(".fn__hidden").classList.remove("fn__hidden");
break;
}
}

View file

@ -67,8 +67,14 @@ export class MobileFiles extends Model {
case "removeDoc":
this.onRemove(data);
break;
case "createdailynote":
case "create":
if (data.data.listDocTree) {
this.selectItem(data.data.box.id, data.data.path);
} else {
this.updateItemArrow(data.data.box.id, data.data.path);
}
break;
case "createdailynote":
case "heading2doc":
case "li2doc":
this.onMkdir(data.data);
@ -267,6 +273,29 @@ export class MobileFiles extends Model {
window.siyuan.menus.menu.fullscreen("bottom");
}
private updateItemArrow(notebookId: string, filePath: string) {
const treeElement = this.element.querySelector(`[data-url="${notebookId}"]`);
if (!treeElement) {
return;
}
let currentPath = filePath;
let liElement
while (!liElement) {
liElement = treeElement.querySelector(`[data-path="${currentPath}"]`);
if (!liElement) {
const dirname = pathPosix().dirname(currentPath);
if (dirname === "/") {
currentPath = dirname;
} else {
currentPath = dirname + ".sy";
}
} else {
liElement.querySelector(".fn__hidden").classList.remove("fn__hidden");
break;
}
}
}
private genNotebook(item: INotebook) {
const emojiHTML = `<span class="b3-list-item__icon b3-tooltips b3-tooltips__e" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].note)}</span>`;
if (item.closed) {