mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
🎨 排序后无法固定滚动位置
This commit is contained in:
parent
0745092dfe
commit
d1576a147e
1 changed files with 6 additions and 2 deletions
|
|
@ -502,6 +502,7 @@ export class Files extends Model {
|
||||||
if (!newUlElement) {
|
if (!newUlElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const oldScrollTop = this.element.scrollTop;
|
||||||
const toURL = newUlElement.getAttribute("data-url");
|
const toURL = newUlElement.getAttribute("data-url");
|
||||||
const toPath = newElement.getAttribute("data-path");
|
const toPath = newElement.getAttribute("data-path");
|
||||||
let gutterType = "";
|
let gutterType = "";
|
||||||
|
|
@ -649,7 +650,7 @@ export class Files extends Model {
|
||||||
showMessage(window.siyuan.languages.emptyContent);
|
showMessage(window.siyuan.languages.emptyContent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.onLsHTML(response.data);
|
this.onLsHTML(response.data, oldScrollTop);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -897,7 +898,7 @@ export class Files extends Model {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onLsHTML(data: { files: IFile[], box: string, path: string }) {
|
private onLsHTML(data: { files: IFile[], box: string, path: string }, scrollTop?: number) {
|
||||||
let fileHTML = "";
|
let fileHTML = "";
|
||||||
data.files.forEach((item: IFile) => {
|
data.files.forEach((item: IFile) => {
|
||||||
fileHTML += this.genFileHTML(item);
|
fileHTML += this.genFileHTML(item);
|
||||||
|
|
@ -924,6 +925,9 @@ export class Files extends Model {
|
||||||
item.classList.remove("file-tree__sliderDown");
|
item.classList.remove("file-tree__sliderDown");
|
||||||
item.removeAttribute("style");
|
item.removeAttribute("style");
|
||||||
});
|
});
|
||||||
|
if (typeof scrollTop === "number") {
|
||||||
|
this.element.scroll({top: scrollTop, behavior: "smooth"})
|
||||||
|
}
|
||||||
}, 120);
|
}, 120);
|
||||||
}, 2);
|
}, 2);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue