mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
b64709c9ec
commit
dc1cc93906
1 changed files with 6 additions and 6 deletions
|
|
@ -928,11 +928,7 @@ export class Files extends Model {
|
||||||
}
|
}
|
||||||
|
|
||||||
private onLsHTML(data: { files: IFile[], box: string, path: string }, scrollTop?: number) {
|
private onLsHTML(data: { files: IFile[], box: string, path: string }, scrollTop?: number) {
|
||||||
let fileHTML = "";
|
if (data.files.length === 0) {
|
||||||
data.files.forEach((item: IFile) => {
|
|
||||||
fileHTML += this.genFileHTML(item);
|
|
||||||
});
|
|
||||||
if (fileHTML === "") {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const liElement = this.element.querySelector(`ul[data-url="${data.box}"] li[data-path="${data.path}"]`);
|
const liElement = this.element.querySelector(`ul[data-url="${data.box}"] li[data-path="${data.path}"]`);
|
||||||
|
|
@ -942,13 +938,17 @@ export class Files extends Model {
|
||||||
let nextElement = liElement.nextElementSibling;
|
let nextElement = liElement.nextElementSibling;
|
||||||
if (nextElement && nextElement.tagName === "UL") {
|
if (nextElement && nextElement.tagName === "UL") {
|
||||||
// 文件展开时,刷新
|
// 文件展开时,刷新
|
||||||
nextElement.innerHTML = fileHTML;
|
// TODO nextElement.innerHTML = fileHTML;
|
||||||
if (typeof scrollTop === "number") {
|
if (typeof scrollTop === "number") {
|
||||||
this.element.scroll({top: scrollTop, behavior: "smooth"});
|
this.element.scroll({top: scrollTop, behavior: "smooth"});
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
liElement.querySelector(".b3-list-item__arrow").classList.add("b3-list-item__arrow--open");
|
liElement.querySelector(".b3-list-item__arrow").classList.add("b3-list-item__arrow--open");
|
||||||
|
let fileHTML = "";
|
||||||
|
data.files.forEach((item: IFile) => {
|
||||||
|
fileHTML += this.genFileHTML(item);
|
||||||
|
});
|
||||||
liElement.insertAdjacentHTML("afterend", `<ul class="file-tree__sliderDown">${fileHTML}</ul>`);
|
liElement.insertAdjacentHTML("afterend", `<ul class="file-tree__sliderDown">${fileHTML}</ul>`);
|
||||||
nextElement = liElement.nextElementSibling;
|
nextElement = liElement.nextElementSibling;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue