Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

Improved performance of swipe up (#9147)

zxhd863943427111608fd3781
diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts
index dc034491a3..de96a7f946 100644
--- a/app/src/protyle/util/onGet.ts
+++ b/app/src/protyle/util/onGet.ts
@@ -157,10 +157,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 {