mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-19 02:21:38 +08:00
🎨 https://github.com/siyuan-note/siyuan/issues/9368 isFullScreen
This commit is contained in:
parent
ec65118339
commit
b869fd1d9d
@ -664,8 +664,16 @@ app.whenReady().then(() => {
|
||||
ipcMain.on("siyuan-first-quit", () => {
|
||||
app.exit();
|
||||
});
|
||||
ipcMain.handle("siyuan-dialog", (event, data) => {
|
||||
return dialog[data.type || "showOpenDialog"](data);
|
||||
ipcMain.handle("siyuan-get", (event, data) => {
|
||||
if (data.cmd === "showOpenDialog") {
|
||||
return dialog.showOpenDialog(data);
|
||||
}
|
||||
if (data.cmd === "showSaveDialog") {
|
||||
return dialog.showSaveDialog(data);
|
||||
}
|
||||
if (data.cmd === "isFullScreen") {
|
||||
return getWindowByContentId(event.sender.id).isFullScreen();
|
||||
}
|
||||
});
|
||||
ipcMain.on("siyuan-cmd", (event, cmd) => {
|
||||
switch (cmd) {
|
||||
|
@ -186,8 +186,8 @@ export const exportConfig = {
|
||||
window.location.href = response.data.zip;
|
||||
});
|
||||
/// #else
|
||||
const filePaths = await ipcRenderer.invoke(Constants.SIYUAN_DIALOG,{
|
||||
type: "showOpenDialogSync",
|
||||
const filePaths = await ipcRenderer.invoke(Constants.SIYUAN_GET,{
|
||||
cmd: "showOpenDialogSync",
|
||||
title: window.siyuan.languages.export + " " + "Data",
|
||||
properties: ["createDirectory", "openDirectory"],
|
||||
});
|
||||
@ -211,8 +211,8 @@ export const exportConfig = {
|
||||
});
|
||||
const pandocBinElement = exportConfig.element.querySelector("#pandocBin") as HTMLInputElement;
|
||||
pandocBinElement.addEventListener("click", async () => {
|
||||
const localPath = await ipcRenderer.invoke(Constants.SIYUAN_DIALOG,{
|
||||
type: "showOpenDialog",
|
||||
const localPath = await ipcRenderer.invoke(Constants.SIYUAN_GET,{
|
||||
cmd: "showOpenDialog",
|
||||
defaultPath: window.siyuan.config.system.homeDir,
|
||||
properties: ["openFile"],
|
||||
});
|
||||
|
@ -25,7 +25,7 @@ export abstract class Constants {
|
||||
|
||||
// 渲染进程调主进程
|
||||
public static readonly SIYUAN_CMD: string = "siyuan-cmd";
|
||||
public static readonly SIYUAN_DIALOG: string = "siyuan-dialog";
|
||||
public static readonly SIYUAN_GET: string = "siyuan-get";
|
||||
|
||||
public static readonly SIYUAN_CONFIG_TRAY: string = "siyuan-config-tray";
|
||||
public static readonly SIYUAN_QUIT: string = "siyuan-quit";
|
||||
|
@ -642,8 +642,8 @@ export const genImportMenu = (notebookId: string, pathString: string) => {
|
||||
if (isDoc) {
|
||||
filters = [{name: "Markdown", extensions: ["md", "markdown"]}];
|
||||
}
|
||||
const localPath = await ipcRenderer.invoke(Constants.SIYUAN_DIALOG, {
|
||||
type: "showOpenDialog",
|
||||
const localPath = await ipcRenderer.invoke(Constants.SIYUAN_GET, {
|
||||
cmd: "showOpenDialog",
|
||||
defaultPath: window.siyuan.config.system.homeDir,
|
||||
filters,
|
||||
properties: [isDoc ? "openFile" : "openDirectory"],
|
||||
|
@ -17,8 +17,8 @@ export const exportAsset = (src: string) => {
|
||||
label: window.siyuan.languages.export,
|
||||
icon: "iconUpload",
|
||||
async click() {
|
||||
const result = await ipcRenderer.invoke(Constants.SIYUAN_DIALOG,{
|
||||
type: "showSaveDialog",
|
||||
const result = await ipcRenderer.invoke(Constants.SIYUAN_GET,{
|
||||
cmd: "showSaveDialog",
|
||||
defaultPath: getAssetName(src) + pathPosix().extname(src),
|
||||
properties: ["showOverwriteConfirmation"],
|
||||
});
|
||||
|
@ -85,8 +85,8 @@ export const workspaceMenu = (app: App, rect: DOMRect) => {
|
||||
label: `${window.siyuan.languages.new} / ${window.siyuan.languages.openBy}`,
|
||||
iconHTML: "",
|
||||
click: async () => {
|
||||
const localPath = await ipcRenderer.invoke(Constants.SIYUAN_DIALOG,{
|
||||
type: "showOpenDialog",
|
||||
const localPath = await ipcRenderer.invoke(Constants.SIYUAN_GET,{
|
||||
cmd: "showOpenDialog",
|
||||
defaultPath: window.siyuan.config.system.homeDir,
|
||||
properties: ["openDirectory", "createDirectory"],
|
||||
});
|
||||
|
@ -545,8 +545,8 @@ const getExportPath = (option: { type: string, id: string }, removeAssets?: bool
|
||||
break;
|
||||
}
|
||||
|
||||
const result = await ipcRenderer.invoke(Constants.SIYUAN_DIALOG, {
|
||||
type: "showOpenDialog",
|
||||
const result = await ipcRenderer.invoke(Constants.SIYUAN_GET, {
|
||||
cmd: "showOpenDialog",
|
||||
title: window.siyuan.languages.export + " " + exportType,
|
||||
properties: ["createDirectory", "openDirectory"],
|
||||
});
|
||||
|
@ -1,11 +1,11 @@
|
||||
import {isWindow} from "../util/functions";
|
||||
import {Wnd} from "../layout/Wnd";
|
||||
import {getCurrentWindow} from "@electron/remote";
|
||||
import {Layout} from "../layout";
|
||||
import {getAllTabs} from "../layout/getAll";
|
||||
import {Editor} from "../editor";
|
||||
import {Asset} from "../asset";
|
||||
import {Constants} from "../constants";
|
||||
import { ipcRenderer } from "electron";
|
||||
|
||||
const getAllWnds = (layout: Layout, wnds: Wnd[]) => {
|
||||
for (let i = 0; i < layout.children.length; i++) {
|
||||
@ -24,7 +24,7 @@ export const setTabPosition = () => {
|
||||
}
|
||||
const wndsTemp: Wnd[] = [];
|
||||
getAllWnds(window.siyuan.layout.layout, wndsTemp);
|
||||
wndsTemp.forEach(item => {
|
||||
wndsTemp.forEach(async item => {
|
||||
const headerElement = item.headersElement.parentElement;
|
||||
const rect = headerElement.getBoundingClientRect();
|
||||
const dragElement = headerElement.querySelector(".item--readonly .fn__flex-1") as HTMLElement;
|
||||
@ -38,7 +38,10 @@ export const setTabPosition = () => {
|
||||
}
|
||||
const headersLastElement = headerElement.lastElementChild as HTMLElement;
|
||||
if ("darwin" === window.siyuan.config.system.os) {
|
||||
if (rect.top <= 0 && rect.left <= 0 && !getCurrentWindow().isFullScreen()) {
|
||||
const isFullScreen = await ipcRenderer.invoke(Constants.SIYUAN_GET, {
|
||||
cmd: "isFullScreen",
|
||||
});
|
||||
if (rect.top <= 0 && rect.left <= 0 && !isFullScreen) {
|
||||
item.headersElement.style.marginLeft = "var(--b3-toolbar-left-mac)";
|
||||
headersLastElement.style.paddingRight = "42px";
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user