mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-15 03:28:07 +01:00
This commit is contained in:
parent
9b2f439675
commit
2c951ab6da
1 changed files with 30 additions and 1 deletions
|
|
@ -85,8 +85,14 @@ export class Files 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.selectItem(data.data.box.id, data.data.path);
|
||||
|
|
@ -754,6 +760,29 @@ export class Files extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue