An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: fix https://github.com/siyuan-note/siyuan/issues/5551
Vanessab458903a4cac
diff --git a/app/src/assets/scss/_toolbar.scss b/app/src/assets/scss/_toolbar.scssindex 7c2b0ad882..ecedd3cffd 100644--- a/app/src/assets/scss/_toolbar.scss+++ b/app/src/assets/scss/_toolbar.scss@@ -6,6 +6,7 @@box-shadow: var(--b3-point-shadow);border-radius: 4px;display: flex;+ transition: top .15s cubic-bezier(0, 0, .2, 1) 0ms;&__item {color: var(--b3-theme-on-surface);diff --git a/app/src/protyle/scroll/event.ts b/app/src/protyle/scroll/event.tsindex bac11ad048..78a7984d8e 100644--- a/app/src/protyle/scroll/event.ts+++ b/app/src/protyle/scroll/event.ts@@ -6,7 +6,23 @@ import {showMessage} from "../../dialog/message";import {updateHotkeyTip} from "../util/compatibility";export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {- element.addEventListener("scroll", () => {+ let elementRect = element.getBoundingClientRect();+ element.addEventListener("scroll", (event) => {+ if (!protyle.toolbar.element.classList.contains("fn__none")) {+ const initY = protyle.toolbar.element.getAttribute("data-inity").split(Constants.ZWSP);+ const top = parseInt(initY[0]) + (parseInt(initY[1]) - element.scrollTop)+ if (elementRect.width === 0) {+ elementRect = element.getBoundingClientRect();+ }+ const toolbarHeight = 29;+ if (top < elementRect.top - toolbarHeight || top > elementRect.bottom - toolbarHeight) {+ protyle.toolbar.element.style.display = "none";+ } else {+ protyle.toolbar.element.style.top = top + "px";+ protyle.toolbar.element.style.display = "";+ }+ return;+ }if (!window.siyuan.dragElement) { // https://ld246.com/article/1649638389841hideElements(["gutter"], protyle);}@@ -50,5 +66,9 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {});}protyle.scroll.lastScrollTop = Math.max(element.scrollTop, 0);+ }, {+ capture: false,+ passive: true,+ once: false});};diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex e82b41abf7..43e4f3ea60 100644--- a/app/src/protyle/toolbar/index.ts+++ b/app/src/protyle/toolbar/index.ts@@ -115,7 +115,9 @@ export class Toolbar {}const rangePosition = getSelectionPosition(nodeElement, range);this.element.classList.remove("fn__none");- setPosition(this.element, rangePosition.left - 52, rangePosition.top - this.toolbarHeight - 4);+ const y = rangePosition.top - this.toolbarHeight - 4+ this.element.setAttribute("data-inity", y + Constants.ZWSP + protyle.contentElement.scrollTop.toString());+ setPosition(this.element, rangePosition.left - 52, y);this.element.querySelectorAll(".protyle-toolbar__item--current").forEach(item => {item.classList.remove("protyle-toolbar__item--current");});diff --git a/app/src/protyle/ui/hideElements.ts b/app/src/protyle/ui/hideElements.tsindex f7c7c52158..5139b18f76 100644--- a/app/src/protyle/ui/hideElements.ts+++ b/app/src/protyle/ui/hideElements.ts@@ -23,6 +23,7 @@ export const hideElements = (panels: string[], protyle?: IProtyle) => {}if (protyle.toolbar && panels.includes("toolbar")) {protyle.toolbar.element.classList.add("fn__none");+ protyle.toolbar.element.style.display = "";}if (protyle.toolbar && panels.includes("util")) {const pinElement = protyle.toolbar.subElement.querySelector('[data-type="pin"]');diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.tsindex f8531d7ab0..8df3086416 100644--- a/app/src/protyle/util/onGet.ts+++ b/app/src/protyle/util/onGet.ts@@ -121,6 +121,7 @@ const setHTML = (options: { content: string, action?: string[] }, protyle: IProt});protyle.contentElement.scrollTop = protyle.contentElement.scrollTop + (removeElement.getBoundingClientRect().top - lastRemoveTop);protyle.scroll.lastScrollTop = protyle.contentElement.scrollTop;+ hideElements(["toolbar"], protyle);}protyle.wysiwyg.element.insertAdjacentHTML("beforeend", options.content);} else if (options.action.includes(Constants.CB_GET_BEFORE)) {@@ -135,6 +136,7 @@ const setHTML = (options: { content: string, action?: string[] }, protyle: IProtprotyle.wysiwyg.element.lastElementChild.getBoundingClientRect().top > window.innerHeight) {protyle.wysiwyg.element.lastElementChild.remove();}+ hideElements(["toolbar"], protyle);}} else {protyle.wysiwyg.element.innerHTML = options.content;