mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-03 03:10:16 +01:00
This commit is contained in:
parent
a99cb898c4
commit
910a600d5d
12 changed files with 400 additions and 388 deletions
|
|
@ -235,7 +235,6 @@ export const setMode = (modeElementValue: number) => {
|
|||
window.siyuan.config.appearance = response.data;
|
||||
/// #if !BROWSER
|
||||
ipcRenderer.send(Constants.SIYUAN_CONFIG_THEME, response.data.modeOS ? "system" : (response.data.mode === 1 ? "dark" : "light"));
|
||||
ipcRenderer.send(Constants.SIYUAN_CONFIG_CLOSE, response.data.closeButtonBehavior);
|
||||
/// #endif
|
||||
loadAssets(response.data);
|
||||
document.querySelector("#barMode use").setAttribute("xlink:href", `#icon${window.siyuan.config.appearance.modeOS ? "Mode" : (window.siyuan.config.appearance.mode === 0 ? "Light" : "Dark")}`);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ export const fetchPost = (url: string, data?: any, cb?: (response: IWebSocketDat
|
|||
if (url === "/api/system/exit" || url === "/api/system/setWorkspaceDir" || (
|
||||
["/api/system/setUILayout"].includes(url) && data.exit // 内核中断,点关闭处理
|
||||
)) {
|
||||
ipcRenderer.send(Constants.SIYUAN_CONFIG_CLOSETRAY);
|
||||
ipcRenderer.send(Constants.SIYUAN_QUIT);
|
||||
}
|
||||
/// #endif
|
||||
|
|
|
|||
|
|
@ -126,14 +126,25 @@ export const onGetConfig = (isStart: boolean) => {
|
|||
data: window.siyuan.config.keymap
|
||||
}, () => {
|
||||
/// #if !BROWSER
|
||||
ipcRenderer.send(Constants.SIYUAN_HOTKEY, hotKey2Electron(window.siyuan.config.keymap.general.toggleWin.custom));
|
||||
ipcRenderer.send(Constants.SIYUAN_HOTKEY, {
|
||||
languages: window.siyuan.languages["_trayMenu"],
|
||||
id: getCurrentWindow().id,
|
||||
hotkey: hotKey2Electron(window.siyuan.config.keymap.general.toggleWin.custom)
|
||||
});
|
||||
/// #endif
|
||||
});
|
||||
}
|
||||
/// #if !BROWSER
|
||||
ipcRenderer.send(Constants.SIYUAN_CONFIG_CLOSE, window.siyuan.config.appearance.closeButtonBehavior);
|
||||
ipcRenderer.send(Constants.SIYUAN_INIT, window.siyuan.languages);
|
||||
ipcRenderer.send(Constants.SIYUAN_HOTKEY, hotKey2Electron(window.siyuan.config.keymap.general.toggleWin.custom));
|
||||
ipcRenderer.send(Constants.SIYUAN_INIT, {
|
||||
languages: window.siyuan.languages["_trayMenu"],
|
||||
workspaceDir: window.siyuan.config.system.workspaceDir,
|
||||
id: getCurrentWindow().id,
|
||||
});
|
||||
ipcRenderer.send(Constants.SIYUAN_HOTKEY, {
|
||||
languages: window.siyuan.languages["_trayMenu"],
|
||||
id: getCurrentWindow().id,
|
||||
hotkey: hotKey2Electron(window.siyuan.config.keymap.general.toggleWin.custom)
|
||||
});
|
||||
/// #endif
|
||||
if (!window.siyuan.config.uiLayout || (window.siyuan.config.uiLayout && !window.siyuan.config.uiLayout.left)) {
|
||||
window.siyuan.config.uiLayout = Constants.SIYUAN_EMPTY_LAYOUT;
|
||||
|
|
@ -332,7 +343,7 @@ const winOnClose = (currentWindow: Electron.BrowserWindow, close = false) => {
|
|||
if (window.siyuan.config.appearance.closeButtonBehavior === 1 && !close) {
|
||||
// 最小化
|
||||
if ("windows" === window.siyuan.config.system.os) {
|
||||
ipcRenderer.send(Constants.SIYUAN_CONFIG_TRAY);
|
||||
ipcRenderer.send(Constants.SIYUAN_CONFIG_TRAY, getCurrentWindow().id);
|
||||
} else {
|
||||
if (currentWindow.isFullScreen()) {
|
||||
currentWindow.once("leave-full-screen", () => currentWindow.hide());
|
||||
|
|
@ -359,10 +370,16 @@ const initWindow = () => {
|
|||
if (!/^siyuan:\/\/blocks\/\d{14}-\w{7}/.test(url)) {
|
||||
return;
|
||||
}
|
||||
openFileById({
|
||||
id: url.substr(16, 22),
|
||||
action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT],
|
||||
zoomIn: getSearch("focus", url) === "1"
|
||||
const id = url.substr(16, 22);
|
||||
fetchPost("/api/block/checkBlockExist", {id}, existResponse => {
|
||||
if (existResponse.data) {
|
||||
openFileById({
|
||||
id,
|
||||
action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT],
|
||||
zoomIn: getSearch("focus", url) === "1"
|
||||
});
|
||||
ipcRenderer.send(Constants.SIYUAN_SHOW, getCurrentWindow().id);
|
||||
}
|
||||
});
|
||||
});
|
||||
ipcRenderer.on(Constants.SIYUAN_SAVE_CLOSE, (event, close) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue