Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/13878

Vanessaee46c6cb0113
diff --git a/app/src/layout/Tab.ts b/app/src/layout/Tab.ts
index b6208b70cc..d0160473c6 100644
--- a/app/src/layout/Tab.ts
+++ b/app/src/layout/Tab.ts
@@ -99,9 +99,7 @@ export class Tab {
tabElement.style.opacity = "0.38";
window.siyuan.dragElement = this.headElement;
}
- if (isWindow() && this.headElement.getBoundingClientRect().top <= 0) {
- ((this.headElement.parentElement.parentElement.querySelector(".item--readonly .fn__flex-1") as HTMLElement).style as CSSStyleDeclarationElectron).WebkitAppRegion = "";
- }
+ ipcRenderer.send(Constants.SIYUAN_SEND_WINDOWS, {cmd: "resetTabsStyle", data: "removeRegionStyle"});
});
this.headElement.addEventListener("dragend", (event: DragEvent & { target: HTMLElement }) => {
const tabElement = hasClosestByTag(event.target, "LI");
@@ -116,7 +114,7 @@ export class Tab {
openNewWindow(this);
}
}, Constants.TIMEOUT_LOAD); // 等待主进程发送关闭消息
- ipcRenderer.send(Constants.SIYUAN_SEND_WINDOWS, {cmd: "resetTabsStyle"});
+ ipcRenderer.send(Constants.SIYUAN_SEND_WINDOWS, {cmd: "resetTabsStyle", data: "rmDragStyle"});
/// #else
document.querySelectorAll(".layout-tab-bars--drag").forEach(item => {
item.classList.remove("layout-tab-bars--drag");
@@ -139,9 +137,7 @@ export class Tab {
}
});
}
- if (isWindow() && this.headElement.getBoundingClientRect().top <= 0) {
- ((this.headElement.parentElement.parentElement.querySelector(".item--readonly .fn__flex-1") as HTMLElement).style as CSSStyleDeclarationElectron).WebkitAppRegion = "drag";
- }
+ ipcRenderer.send(Constants.SIYUAN_SEND_WINDOWS, {cmd: "resetTabsStyle", data: "addRegionStyle"});
});
}
diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.ts
index 894e775d60..07f8c48e89 100644
--- a/app/src/layout/dock/Files.ts
+++ b/app/src/layout/dock/Files.ts
@@ -471,7 +471,7 @@ export class Files extends Model {
});
window.siyuan.dragElement = undefined;
/// #if !BROWSER
- ipcRenderer.send(Constants.SIYUAN_SEND_WINDOWS, {cmd: "resetTabsStyle"});
+ ipcRenderer.send(Constants.SIYUAN_SEND_WINDOWS, {cmd: "resetTabsStyle", data: "rmDragStyle"});
/// #else
document.querySelectorAll(".layout-tab-bars--drag").forEach(item => {
item.classList.remove("layout-tab-bars--drag");
diff --git a/app/src/window/onWindowsMsg.ts b/app/src/window/onWindowsMsg.ts
index b0c81cb1d8..59e2084b2e 100644
--- a/app/src/window/onWindowsMsg.ts
+++ b/app/src/window/onWindowsMsg.ts
@@ -2,6 +2,7 @@ import {exportLayout, getInstanceById} from "../layout/util";
import {Tab} from "../layout/Tab";
import {fetchPost} from "../util/fetch";
import {redirectToCheckAuth} from "../util/pathName";
+import {isWindow} from "../util/functions";
const closeTab = (ipcData: IWebSocketData) => {
const tab = getInstanceById(ipcData.data);
@@ -15,12 +16,25 @@ export const onWindowsMsg = (ipcData: IWebSocketData) => {
closeTab(ipcData);
break;
case "resetTabsStyle":
- document.querySelectorAll(".layout-tab-bars--drag").forEach(item => {
- item.classList.remove("layout-tab-bars--drag");
- });
- document.querySelectorAll(".layout-tab-bar li[data-clone='true']").forEach(tabItem => {
- tabItem.remove();
- });
+ // data: addRegionStyle, rmDragStyle, rmDragStyleRegionStyle
+ if (ipcData.data === "rmDragStyle") {
+ document.querySelectorAll(".layout-tab-bars--drag").forEach(item => {
+ item.classList.remove("layout-tab-bars--drag");
+ });
+ document.querySelectorAll(".layout-tab-bar li[data-clone='true']").forEach(tabItem => {
+ tabItem.remove();
+ });
+ } else if (isWindow()) {
+ document.querySelectorAll(".layout-tab-bar--readonly > .fn__flex-1").forEach((item: HTMLElement) => {
+ if (item.getBoundingClientRect().top <= 0) {
+ if (ipcData.data === "addRegionStyle") {
+ (item.style as CSSStyleDeclarationElectron).WebkitAppRegion = "drag";
+ } else if (ipcData.data === "removeRegionStyle") {
+ (item.style as CSSStyleDeclarationElectron).WebkitAppRegion = "";
+ }
+ }
+ });
+ }
break;
case "lockscreen":
exportLayout({