From ad574a3cde7561529a77f9c1001dbd79c77cf4a1 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 27 Mar 2024 11:02:59 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/10765 --- app/src/protyle/breadcrumb/action.ts | 30 ++++++++++++++-------------- app/src/window/setHeader.ts | 5 +++-- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/app/src/protyle/breadcrumb/action.ts b/app/src/protyle/breadcrumb/action.ts index f0bd667f3..5925d7cb7 100644 --- a/app/src/protyle/breadcrumb/action.ts +++ b/app/src/protyle/breadcrumb/action.ts @@ -46,7 +46,21 @@ export const fullscreen = (element: Element, btnElement?: Element) => { element.classList.add("fullscreen"); document.getElementById("drag")?.classList.add("fn__hidden"); } - + if (isWindow()) { + // 编辑器全屏 + /// #if !MOBILE + const wndsTemp: Wnd[] = []; + getAllWnds(window.siyuan.layout.layout, wndsTemp); + wndsTemp.find(async item => { + const headerElement = item.headersElement.parentElement; + if (headerElement.getBoundingClientRect().top <= 0) { + // @ts-ignore + (headerElement.querySelector(".item--readonly .fn__flex-1") as HTMLElement).style.WebkitAppRegion = isFullscreen ? "drag" : ""; + return true; + } + }); + /// #endif + } if (btnElement) { if (isFullscreen) { btnElement.querySelector("use").setAttribute("xlink:href", "#iconFullscreen"); @@ -64,20 +78,6 @@ export const fullscreen = (element: Element, btnElement?: Element) => { } } return; - } else if (isWindow()) { - // 编辑器全屏 - /// #if !MOBILE - const wndsTemp: Wnd[] = []; - getAllWnds(window.siyuan.layout.layout, wndsTemp); - wndsTemp.find(async item => { - const headerElement = item.headersElement.parentElement; - if (headerElement.getBoundingClientRect().top <= 0) { - // @ts-ignore - (headerElement.querySelector(".item--readonly .fn__flex-1") as HTMLElement).style.WebkitAppRegion = isFullscreen ? "drag" : ""; - return; - } - }); - /// #endif } /// #if !MOBILE if (element.classList.contains("protyle")) { diff --git a/app/src/window/setHeader.ts b/app/src/window/setHeader.ts index 65f08d529..19cc5a6af 100644 --- a/app/src/window/setHeader.ts +++ b/app/src/window/setHeader.ts @@ -30,10 +30,11 @@ export const setTabPosition = () => { cmd: "isFullScreen", }); if (rect.top <= 0 && rect.left <= 0 && !isFullScreen) { - item.headersElement.style.marginLeft = "var(--b3-toolbar-left-mac)"; + // 用 marginLeft 左侧底部无线条 + item.headersElement.style.paddingLeft = "var(--b3-toolbar-left-mac)"; headersLastElement.style.paddingRight = "42px"; } else { - item.headersElement.style.marginLeft = ""; + item.headersElement.style.paddingLeft = ""; headersLastElement.style.paddingRight = ""; } }