mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
This commit is contained in:
parent
04f47749f7
commit
22a926946c
5 changed files with 23 additions and 3 deletions
|
|
@ -670,6 +670,11 @@ app.whenReady().then(() => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
ipcMain.on('siyuan-closetab', (event, data) => {
|
||||||
|
BrowserWindow.getAllWindows().forEach(item => {
|
||||||
|
item.webContents.send('siyuan-closetab', data)
|
||||||
|
})
|
||||||
|
})
|
||||||
ipcMain.on('siyuan-export-pdf', (event, data) => {
|
ipcMain.on('siyuan-export-pdf', (event, data) => {
|
||||||
BrowserWindow.fromId(data.id).webContents.send('siyuan-export-pdf', data)
|
BrowserWindow.fromId(data.id).webContents.send('siyuan-export-pdf', data)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ export abstract class Constants {
|
||||||
public static readonly SIYUAN_HOTKEY: string = "siyuan-hotkey";
|
public static readonly SIYUAN_HOTKEY: string = "siyuan-hotkey";
|
||||||
public static readonly SIYUAN_INIT: string = "siyuan-init";
|
public static readonly SIYUAN_INIT: string = "siyuan-init";
|
||||||
public static readonly SIYUAN_OPENURL: string = "siyuan-openurl";
|
public static readonly SIYUAN_OPENURL: string = "siyuan-openurl";
|
||||||
|
public static readonly SIYUAN_CLOSETAB: string = "siyuan-closetab";
|
||||||
public static readonly SIYUAN_SAVE_CLOSE: string = "siyuan-save-close";
|
public static readonly SIYUAN_SAVE_CLOSE: string = "siyuan-save-close";
|
||||||
public static readonly SIYUAN_EXPORT_PDF: string = "siyuan-export-pdf";
|
public static readonly SIYUAN_EXPORT_PDF: string = "siyuan-export-pdf";
|
||||||
public static readonly SIYUAN_EXPORT_CLOSE: string = "siyuan-export-close";
|
public static readonly SIYUAN_EXPORT_CLOSE: string = "siyuan-export-close";
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import {Graph} from "./dock/Graph";
|
||||||
import {hasClosestByAttribute, hasClosestByClassName, hasClosestByTag} from "../protyle/util/hasClosest";
|
import {hasClosestByAttribute, hasClosestByClassName, hasClosestByTag} from "../protyle/util/hasClosest";
|
||||||
import {Constants} from "../constants";
|
import {Constants} from "../constants";
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
import {webFrame} from "electron";
|
import {webFrame, ipcRenderer} from "electron";
|
||||||
import {getCurrentWindow} from "@electron/remote";
|
import {getCurrentWindow} from "@electron/remote";
|
||||||
import {setTabPosition} from "../window/setHeader";
|
import {setTabPosition} from "../window/setHeader";
|
||||||
/// #endif
|
/// #endif
|
||||||
|
|
@ -298,9 +298,15 @@ export class Wnd {
|
||||||
const targetWnd = getInstanceById(targetWndElement.getAttribute("data-id")) as Wnd;
|
const targetWnd = getInstanceById(targetWndElement.getAttribute("data-id")) as Wnd;
|
||||||
const tabId = event.dataTransfer.getData(Constants.SIYUAN_DROP_TAB);
|
const tabId = event.dataTransfer.getData(Constants.SIYUAN_DROP_TAB);
|
||||||
let oldTab = getInstanceById(tabId) as Tab;
|
let oldTab = getInstanceById(tabId) as Tab;
|
||||||
if (isWindow() && !oldTab) { // 从主窗口拖拽到页签新窗口
|
/// #if !BROWSER
|
||||||
|
if (!oldTab) { // 从主窗口拖拽到页签新窗口
|
||||||
JSONToCenter(JSON.parse(event.dataTransfer.getData(Constants.SIYUAN_DROP_TABTOWINDOW)), this);
|
JSONToCenter(JSON.parse(event.dataTransfer.getData(Constants.SIYUAN_DROP_TABTOWINDOW)), this);
|
||||||
oldTab = this.children[this.children.length - 1];
|
oldTab = this.children[this.children.length - 1];
|
||||||
|
ipcRenderer.send(Constants.SIYUAN_CLOSETAB, tabId);
|
||||||
|
}
|
||||||
|
/// #endif
|
||||||
|
if (!oldTab) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (oldTab.model instanceof Asset) {
|
if (oldTab.model instanceof Asset) {
|
||||||
// https://github.com/siyuan-note/siyuan/issues/6890
|
// https://github.com/siyuan-note/siyuan/issues/6890
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {openSearch} from "../search/spread";
|
import {openSearch} from "../search/spread";
|
||||||
import {exportLayout, JSONToLayout, resetLayout, resizeDrag, resizeTabs} from "../layout/util";
|
import {exportLayout, getInstanceById, JSONToLayout, resetLayout, resizeDrag, resizeTabs} from "../layout/util";
|
||||||
import {hotKey2Electron, setStorageVal, updateHotkeyTip} from "../protyle/util/compatibility";
|
import {hotKey2Electron, setStorageVal, updateHotkeyTip} from "../protyle/util/compatibility";
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
import {dialog, getCurrentWindow} from "@electron/remote";
|
import {dialog, getCurrentWindow} from "@electron/remote";
|
||||||
|
|
@ -30,6 +30,7 @@ import {replaceLocalPath} from "../editor/rename";
|
||||||
import {workspaceMenu} from "../menus/workspace";
|
import {workspaceMenu} from "../menus/workspace";
|
||||||
import {getWorkspaceName} from "./noRelyPCFunction";
|
import {getWorkspaceName} from "./noRelyPCFunction";
|
||||||
import {setTabPosition} from "../window/setHeader";
|
import {setTabPosition} from "../window/setHeader";
|
||||||
|
import { Tab } from "../layout/Tab";
|
||||||
|
|
||||||
const matchKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {
|
const matchKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {
|
||||||
if (key1 === "general") {
|
if (key1 === "general") {
|
||||||
|
|
@ -355,6 +356,12 @@ export const initWindow = () => {
|
||||||
winOnClose(currentWindow, close);
|
winOnClose(currentWindow, close);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
ipcRenderer.on(Constants.SIYUAN_CLOSETAB, (e, ipcData) => {
|
||||||
|
const tab = getInstanceById(ipcData);
|
||||||
|
if (tab && tab instanceof Tab) {
|
||||||
|
tab.parent.removeTab(ipcData);
|
||||||
|
}
|
||||||
|
});
|
||||||
ipcRenderer.on(Constants.SIYUAN_LOCK_SCREEN, () => {
|
ipcRenderer.on(Constants.SIYUAN_LOCK_SCREEN, () => {
|
||||||
exportLayout(false, () => {
|
exportLayout(false, () => {
|
||||||
fetchPost("/api/system/logoutAuth", {}, () => {
|
fetchPost("/api/system/logoutAuth", {}, () => {
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ export const init = () => {
|
||||||
fetchPost("/api/system/getEmojiConf", {}, response => {
|
fetchPost("/api/system/getEmojiConf", {}, response => {
|
||||||
window.siyuan.emojis = response.data as IEmoji[];
|
window.siyuan.emojis = response.data as IEmoji[];
|
||||||
const tabJSON = JSON.parse(getSearch("json"));
|
const tabJSON = JSON.parse(getSearch("json"));
|
||||||
|
tabJSON.active = true;
|
||||||
JSONToCenter({
|
JSONToCenter({
|
||||||
direction: "lr",
|
direction: "lr",
|
||||||
resize: "lr",
|
resize: "lr",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue