Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of swipe-up doc loading #9147

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions app/src/protyle/util/onGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,15 @@ const setHTML = (options: {
protyle.scroll.lastScrollTop = protyle.contentElement.scrollTop;
// 动态加载移除
if (!protyle.wysiwyg.element.querySelector(".protyle-wysiwyg--select") && !protyle.scroll.keepLazyLoad) {
while (protyle.wysiwyg.element.childElementCount > 2 && protyle.contentElement.scrollHeight > REMOVED_OVER_HEIGHT &&
protyle.wysiwyg.element.lastElementChild.getBoundingClientRect().top > window.innerHeight) {
protyle.wysiwyg.element.lastElementChild.remove();
const removeElements:HTMLElement[] = []
if (protyle.wysiwyg.element.childElementCount > 2 && protyle.contentElement.scrollHeight > REMOVED_OVER_HEIGHT){
protyle.wysiwyg.element.childNodes.forEach((el)=>{
if((el as HTMLElement).getBoundingClientRect().top > window.innerHeight * 2){
removeElements.push((el as HTMLElement))
}
})
}
removeElements.forEach((el)=>{el.remove()})
hideElements(["toolbar"], protyle);
}
} else {
Expand Down
Loading