Skip to content

Commit

Permalink
Improved performance of swipe up (#9147)
Browse files Browse the repository at this point in the history
  • Loading branch information
zxhd863943427 authored Sep 18, 2023
1 parent ffd153d commit 111608f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/src/protyle/util/onGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 111608f

Please sign in to comment.