Vanessa 2025-03-30 17:50:33 +08:00
parent f58c2df52c
commit 1eaec1d180
4 changed files with 18 additions and 17 deletions

View file

@ -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") {

View file

@ -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
}) {

View file

@ -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)) {

View file

@ -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":