mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
🎨 重启后 listDocsByPath 请求重复
This commit is contained in:
parent
b508170638
commit
0636b2e1fb
1 changed files with 12 additions and 10 deletions
|
|
@ -1019,16 +1019,6 @@ data-type="navigation-root" data-path="/">
|
||||||
let fileHTML = "";
|
let fileHTML = "";
|
||||||
data.files.forEach((item: IFile) => {
|
data.files.forEach((item: IFile) => {
|
||||||
fileHTML += this.genFileHTML(item);
|
fileHTML += this.genFileHTML(item);
|
||||||
if (filePath === item.path) {
|
|
||||||
this.selectItem(data.box, filePath, undefined, setStorage);
|
|
||||||
} else if (filePath.startsWith(item.path.replace(".sy", ""))) {
|
|
||||||
fetchPost("/api/filetree/listDocsByPath", {
|
|
||||||
notebook: data.box,
|
|
||||||
path: item.path
|
|
||||||
}, response => {
|
|
||||||
this.selectItem(response.data.box, filePath, response.data, setStorage);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
if (fileHTML === "") {
|
if (fileHTML === "") {
|
||||||
return;
|
return;
|
||||||
|
|
@ -1046,6 +1036,18 @@ data-type="navigation-root" data-path="/">
|
||||||
emojiElement.textContent = unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].folder);
|
emojiElement.textContent = unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].folder);
|
||||||
}
|
}
|
||||||
liElement.insertAdjacentHTML("afterend", `<ul>${fileHTML}</ul>`);
|
liElement.insertAdjacentHTML("afterend", `<ul>${fileHTML}</ul>`);
|
||||||
|
data.files.forEach((item: IFile) => {
|
||||||
|
if (filePath === item.path) {
|
||||||
|
this.selectItem(data.box, filePath, undefined, setStorage);
|
||||||
|
} else if (filePath.startsWith(item.path.replace(".sy", ""))) {
|
||||||
|
fetchPost("/api/filetree/listDocsByPath", {
|
||||||
|
notebook: data.box,
|
||||||
|
path: item.path
|
||||||
|
}, response => {
|
||||||
|
this.selectItem(response.data.box, filePath, response.data, setStorage);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
if (setStorage) {
|
if (setStorage) {
|
||||||
this.setCurrent(this.element.querySelector(`ul[data-url="${data.box}"] li[data-path="${filePath}"]`));
|
this.setCurrent(this.element.querySelector(`ul[data-url="${data.box}"] li[data-path="${filePath}"]`));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue