An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:zap: fix https://github.com/siyuan-note/siyuan/pull/9147
Vanessac11c434502e4
diff --git a/app/src/protyle/scroll/event.ts b/app/src/protyle/scroll/event.tsindex a87ba6828c..0013ce546f 100644--- a/app/src/protyle/scroll/event.ts+++ b/app/src/protyle/scroll/event.ts@@ -64,6 +64,7 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {const blockElement = hasClosestBlock(targetElement);if (!blockElement) {if ((protyle.wysiwyg.element.firstElementChild.getAttribute("data-eof") === "1" ||+ // goHome 时 data-eof 不为 1protyle.wysiwyg.element.firstElementChild.getAttribute("data-node-index") === "0") &&(hasClosestByClassName(targetElement, "protyle-background") || hasClosestByClassName(targetElement, "protyle-title"))) {const inputElement = protyle.scroll.element.querySelector(".b3-slider") as HTMLInputElement;diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.tsindex de96a7f946..8d367a0df9 100644--- a/app/src/protyle/util/onGet.ts+++ b/app/src/protyle/util/onGet.ts@@ -150,22 +150,26 @@ const setHTML = (options: {}protyle.wysiwyg.element.insertAdjacentHTML("beforeend", options.content);} else if (options.action.includes(Constants.CB_GET_BEFORE)) {- const lastElement = protyle.wysiwyg.element.firstElementChild as HTMLElement;- const lastTop = lastElement.getBoundingClientRect().top;+ const firstElement = protyle.wysiwyg.element.firstElementChild as HTMLElement;+ const lastTop = firstElement.getBoundingClientRect().top;protyle.wysiwyg.element.insertAdjacentHTML("afterbegin", options.content);- protyle.contentElement.scrollTop = protyle.contentElement.scrollTop + (lastElement.getBoundingClientRect().top - lastTop);+ protyle.contentElement.scrollTop = protyle.contentElement.scrollTop + (firstElement.getBoundingClientRect().top - lastTop);protyle.scroll.lastScrollTop = protyle.contentElement.scrollTop;// 动态加载移除if (!protyle.wysiwyg.element.querySelector(".protyle-wysiwyg--select") && !protyle.scroll.keepLazyLoad) {- 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))- }- })+ const removeElements: Element[] = []+ let childCount = protyle.wysiwyg.element.childElementCount;+ let scrollHeight = protyle.contentElement.scrollHeight;+ let lastElement = protyle.wysiwyg.element.lastElementChild;+ while (childCount > 2 && scrollHeight > REMOVED_OVER_HEIGHT && lastElement.getBoundingClientRect().top > window.innerHeight) {+ removeElements.push(lastElement);+ lastElement = lastElement.previousElementSibling;+ childCount--;+ scrollHeight -= lastElement.clientHeight + 8; // 大部分元素的 margin}- removeElements.forEach((el)=>{el.remove()})+ removeElements.forEach((item) => {+ item.remove();+ });hideElements(["toolbar"], protyle);}} else {