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: https://github.com/siyuan-note/siyuan/issues/10749
Vanessa2e2f20b03ead
diff --git a/app/src/assets/scss/util/_reset.scss b/app/src/assets/scss/util/_reset.scssindex 34e1978e1a..106a150f78 100644--- a/app/src/assets/scss/util/_reset.scss+++ b/app/src/assets/scss/util/_reset.scss@@ -146,6 +146,25 @@ body {.toolbar #drag {-webkit-app-region: none;color: transparent;+ height: 42px;+ position: relative;++ &::before,+ &::after {+ content: "";+ width: var(--b3-toolbar-drag-left);+ height: 42px;+ position: absolute;+ left: 0;+ top: 0;+ -webkit-app-region: drag;+ }++ &::after {+ left: auto;+ right: 0;+ width: var(--b3-toolbar-drag-right);+ }}.layout__empty {diff --git a/app/src/window/setHeader.ts b/app/src/window/setHeader.tsindex 1f8efeabb8..59e6a1e51e 100644--- a/app/src/window/setHeader.ts+++ b/app/src/window/setHeader.ts@@ -22,37 +22,46 @@ export const setTabPosition = (onlyPadding = false) => {}const centerRect = (isWindowMode ? window.siyuan.layout.layout : window.siyuan.layout.centerLayout).element.getBoundingClientRect();- const dragRect = document.getElementById("drag")?.getBoundingClientRect() || {left: 0, right: 0};- const paddingLeft = ("darwin" === window.siyuan.config.system.os && isWindowMode) ?- parseInt(getComputedStyle(document.body).getPropertyValue("--b3-toolbar-left-mac")) : dragRect.left - centerRect.left;- const paddingRight = isWindowMode ?- document.querySelector(".toolbar__window").clientWidth : centerRect.right - dragRect.right;+ const toolbarDragElement = document.getElementById("drag");+ const toolbarDragRect = toolbarDragElement?.getBoundingClientRect() || {left: 0, right: 0};+ if (toolbarDragElement) {+ toolbarDragElement.style.removeProperty("--b3-toolbar-drag-left");+ toolbarDragElement.style.removeProperty("--b3-toolbar-drag-right");+ }wndsTemp.forEach(item => {const headerElement = item.headersElement.parentElement;- const rect = headerElement.getBoundingClientRect();+ const headerRect = headerElement.getBoundingClientRect();headerElement.style.paddingLeft = "";(headerElement.lastElementChild as HTMLElement).style.marginRight = "";headerElement.style.visibility = "";- if (rect.top <= 0) {+ if (headerRect.top <= 0) {// header padding- if (rect.left - 1 <= centerRect.left) {- headerElement.style.paddingLeft = paddingLeft + "px";- } else if (rect.left < dragRect.left) {- headerElement.style.paddingLeft = (dragRect.left - rect.left) + "px";+ if (isWindowMode) {+ if (headerRect.left === 0) {+ headerElement.style.paddingLeft = getComputedStyle(document.body).getPropertyValue("--b3-toolbar-left-mac");+ }+ } else {+ if (headerRect.left > toolbarDragRect.left && headerRect.left === centerRect.left) {+ toolbarDragElement.style.setProperty("--b3-toolbar-drag-left", headerRect.left - toolbarDragRect.left + "px");+ } else if (headerRect.left < toolbarDragRect.left) {+ headerElement.style.paddingLeft = (toolbarDragRect.left - headerRect.left) + "px";+ }}- // 不能取 clientWidth,因为设置了 min-width(103) 导致 clientWidth 大于实际宽度- if (rect.right + 1 >= centerRect.right) {- if (paddingRight + 103 > rect.width) {- headerElement.style.visibility = "hidden";- } else if (paddingRight > 0) {- (headerElement.lastElementChild as HTMLElement).style.marginRight = paddingRight + "px";+ if (isWindowMode) {+ if (headerRect.right === centerRect.right) {+ (headerElement.lastElementChild as HTMLElement).style.marginRight = document.querySelector(".toolbar__window").clientWidth + "px";}- } else if (rect.right > dragRect.right) {- if (paddingRight + 103 > rect.width) {- headerElement.style.visibility = "hidden";- } else if (rect.right - dragRect.right > 0) {- (headerElement.lastElementChild as HTMLElement).style.marginRight = (rect.right - dragRect.right) + "px";+ } else {+ if (headerRect.right < toolbarDragRect.right && headerRect.right === centerRect.right) {+ toolbarDragElement.style.setProperty("--b3-toolbar-drag-right", toolbarDragRect.right - headerRect.right + "px");+ } else if (headerRect.right > toolbarDragRect.right) {+ // 不能取 clientWidth,因为设置了 min-width(64) 导致 clientWidth 大于实际宽度+ if (headerRect.right - toolbarDragRect.right + 64 > headerRect.width) {+ headerElement.style.visibility = "hidden";+ } else {+ (headerElement.lastElementChild as HTMLElement).style.marginRight = (headerRect.right - toolbarDragRect.right) + "px";+ }}}}@@ -64,7 +73,7 @@ export const setTabPosition = (onlyPadding = false) => {item.element.classList.remove("layout__wnd--right", "layout__wnd--left", "layout__wnd--center");(item.element.querySelector(".layout-tab-container") as HTMLElement).style.backgroundColor = "";const dragElement = headerElement.querySelector(".item--readonly .fn__flex-1") as HTMLElement;- if (rect.top <= 0) {+ if (headerRect.top <= 0) {// emptyif (headerElement.classList.contains("fn__none")) {(item.element.querySelector(".layout-tab-container") as HTMLElement).style.backgroundColor = "transparent";@@ -73,14 +82,14 @@ export const setTabPosition = (onlyPadding = false) => {// header transparentitem.element.classList.add("layout__wnd--center");if (!isWindowMode) {- if (rect.left - 1 <= centerRect.left) {+ if (headerRect.left - 1 <= centerRect.left) {item.element.classList.add("layout__wnd--left");}- if (rect.right + 1 >= centerRect.right) {+ if (headerRect.right + 1 >= centerRect.right) {item.element.classList.add("layout__wnd--right");}}- dragElement.parentElement.parentElement.style.minWidth = "95px";+ dragElement.parentElement.parentElement.style.minWidth = "56px";dragElement.style.height = dragElement.parentElement.clientHeight + "px";(dragElement.style as CSSStyleDeclarationElectron).WebkitAppRegion = "drag";} else {