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