Something went wrong. Try again.
A privacy-first, self-hosted, fully open source personal knowledge management software, written in typescript and golang. (PERSONAL FORK)
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425262728293031323334353637383940414243444546import {getInstanceById} from "../layout/util";import {Tab} from "../layout/Tab";import {isWindow} from "../util/functions";import {lockScreen} from "../dialog/processSystem";import {App} from "../index";
const closeTab = (ipcData: IWebSocketData) => { const tab = getInstanceById(ipcData.data); if (tab && tab instanceof Tab) { tab.parent.removeTab(ipcData.data); }};export const onWindowsMsg = (ipcData: IWebSocketData, app: App) => { switch (ipcData.cmd) { case "closetab": 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 "lockscreenByMode": if (window.siyuan.config.system.lockScreenMode === 1) { lockScreen(app); } break; }};