mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
This commit is contained in:
parent
7e09c1b704
commit
ee46c6cb01
3 changed files with 24 additions and 14 deletions
|
|
@ -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"});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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":
|
||||
// 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({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue