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/issues/4620
Vanessaa090043aa6b4
diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.tsindex d565064248..33b332a74e 100644--- a/app/src/protyle/util/onGet.ts+++ b/app/src/protyle/util/onGet.ts@@ -99,15 +99,39 @@ const setHTML = (options: { content: string, action?: string[] }, protyle: IProtreturn;}protyle.block.showAll = options.action.includes(Constants.CB_GET_ALL);+ const REMOVED_OVER_HEIGHT = protyle.contentElement.clientHeight * 8if (options.action.includes(Constants.CB_GET_APPEND)) {+ // 动态加载移除+ if (protyle.contentElement.scrollHeight > REMOVED_OVER_HEIGHT) {+ preventScroll(protyle);+ let removeElement = protyle.wysiwyg.element.firstElementChild as HTMLElement;+ const removeElements = [];+ while (protyle.wysiwyg.element.childElementCount > 2) {+ if (protyle.contentElement.scrollHeight - removeElement.offsetTop > REMOVED_OVER_HEIGHT) {+ removeElements.push(removeElement);+ } else {+ break;+ }+ removeElement = removeElement.nextElementSibling as HTMLElement;+ }+ const lastRemoveTop = removeElement.getBoundingClientRect().top;+ removeElements.forEach(item => {+ item.remove();+ });+ protyle.contentElement.scrollTop = protyle.contentElement.scrollTop + (removeElement.getBoundingClientRect().top - lastRemoveTop);+ }protyle.wysiwyg.element.insertAdjacentHTML("beforeend", options.content);} else if (options.action.includes(Constants.CB_GET_BEFORE)) {+ preventScroll(protyle);const lastElement = protyle.wysiwyg.element.firstElementChild as HTMLElement;- const lastTop = lastElement.getBoundingClientRect().top - protyle.element.getBoundingClientRect().top;+ const lastTop = lastElement.getBoundingClientRect().top;protyle.wysiwyg.element.insertAdjacentHTML("afterbegin", options.content);- const appendHeight = lastElement.offsetTop - lastTop;- protyle.contentElement.scrollTop = appendHeight;- protyle.scroll.lastScrollTop = appendHeight;+ protyle.contentElement.scrollTop = protyle.contentElement.scrollTop + (lastElement.getBoundingClientRect().top - lastTop);+ // 动态加载移除+ while (protyle.wysiwyg.element.childElementCount > 2 && protyle.contentElement.scrollHeight > REMOVED_OVER_HEIGHT &&+ protyle.wysiwyg.element.lastElementChild.getBoundingClientRect().bottom > window.innerHeight) {+ protyle.wysiwyg.element.lastElementChild.remove();+ }} else {protyle.wysiwyg.element.innerHTML = options.content;}