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

Vanessa1eaec1d18003
diff --git a/app/src/layout/Tab.ts b/app/src/layout/Tab.ts
index bc8c568a32..e147a8c08b 100644
--- a/app/src/layout/Tab.ts
+++ b/app/src/layout/Tab.ts
@@ -104,9 +104,6 @@ export class Tab {
const tabElement = hasClosestByTag(event.target, "LI");
if (tabElement) {
tabElement.style.opacity = "1";
- document.querySelectorAll(".layout-tab-bar li[data-clone='true']").forEach((item) => {
- item.remove();
- });
}
/// #if !BROWSER
// 拖拽到屏幕外
@@ -114,9 +111,16 @@ export class Tab {
if (document.body.contains(this.panelElement) &&
(event.clientX < 0 || event.clientY < 0 || event.clientX > window.innerWidth || event.clientY > window.innerHeight)) {
openNewWindow(this);
- ipcRenderer.send(Constants.SIYUAN_SEND_WINDOWS, {cmd: "resetTabsStyle"});
}
}, Constants.TIMEOUT_LOAD); // 等待主进程发送关闭消息
+ ipcRenderer.send(Constants.SIYUAN_SEND_WINDOWS, {cmd: "resetTabsStyle"});
+ /// #else
+ 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();
+ });
/// #endif
window.siyuan.dragElement = undefined;
if (event.dataTransfer.dropEffect === "none") {
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts
index b93a2d559e..fac56a54cf 100644
--- a/app/src/layout/Wnd.ts
+++ b/app/src/layout/Wnd.ts
@@ -232,16 +232,6 @@ export class Wnd {
}
});
- this.headersElement.parentElement.addEventListener("dragend", () => {
- document.querySelectorAll(".layout-tab-bars--drag").forEach(item => {
- item.classList.remove("layout-tab-bars--drag");
- });
- // 窗口拖拽到新窗口时,不 drop 无法移除 clone 的元素
- document.querySelectorAll(".layout-tab-bar li[data-clone='true']").forEach(item => {
- item.remove();
- });
- });
-
this.headersElement.parentElement.addEventListener("drop", function (event: DragEvent & {
target: HTMLElement
}) {
diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.ts
index 37a82520a1..170ae39ee9 100644
--- a/app/src/layout/dock/Files.ts
+++ b/app/src/layout/dock/Files.ts
@@ -25,6 +25,9 @@ import {
import {isTouchDevice} from "../../util/functions";
import {App} from "../../index";
import {refreshFileTree} from "../../dialog/processSystem";
+/// #if !BROWSER
+import {ipcRenderer} from "electron";
+/// #endif
import {hideTooltip, showTooltip} from "../../dialog/tooltip";
export class Files extends Model {
@@ -467,9 +470,13 @@ export class Files extends Model {
}
});
window.siyuan.dragElement = undefined;
+ /// #if !BROWSER
+ ipcRenderer.send(Constants.SIYUAN_SEND_WINDOWS, {cmd: "resetTabsStyle"});
+ /// #else
document.querySelectorAll(".layout-tab-bars--drag").forEach(item => {
item.classList.remove("layout-tab-bars--drag");
});
+ /// #endif
});
this.element.addEventListener("dragover", (event: DragEvent & { target: HTMLElement }) => {
if (window.siyuan.config.readonly || event.dataTransfer.types.includes(Constants.SIYUAN_DROP_TAB)) {
diff --git a/app/src/window/onWindowsMsg.ts b/app/src/window/onWindowsMsg.ts
index 680d0ffbb3..b0c81cb1d8 100644
--- a/app/src/window/onWindowsMsg.ts
+++ b/app/src/window/onWindowsMsg.ts
@@ -17,9 +17,9 @@ export const onWindowsMsg = (ipcData: IWebSocketData) => {
case "resetTabsStyle":
document.querySelectorAll(".layout-tab-bars--drag").forEach(item => {
item.classList.remove("layout-tab-bars--drag");
- item.querySelectorAll(".layout-tab-bar li[data-clone='true']").forEach(tabItem => {
- tabItem.remove();
- });
+ });
+ document.querySelectorAll(".layout-tab-bar li[data-clone='true']").forEach(tabItem => {
+ tabItem.remove();
});
break;
case "lockscreen":