Vanessa 2023-05-08 21:00:41 +08:00
parent 875f00398e
commit 99725ea21d
14 changed files with 122 additions and 40 deletions

View file

@ -53,6 +53,7 @@ import {reloadProtyle} from "../protyle/util/reload";
import {fullscreen} from "../protyle/breadcrumb/action";
import {setPadding} from "../protyle/ui/initUI";
import {openRecentDocs} from "../business/openRecentDocs";
import {App} from "../index";
const getRightBlock = (element: HTMLElement, x: number, y: number) => {
let index = 1;
@ -95,7 +96,7 @@ const switchDialogEvent = (event: MouseEvent, switchDialog: Dialog) => {
}
};
export const globalShortcut = () => {
export const globalShortcut = (app: App) => {
document.body.addEventListener("mouseleave", () => {
if (window.siyuan.layout.leftDock) {
window.siyuan.layout.leftDock.hideDock();
@ -630,7 +631,7 @@ export const globalShortcut = () => {
return;
}
if (!isTabWindow && !window.siyuan.config.readonly && matchHotKey(window.siyuan.config.keymap.general.config.custom, event)) {
openSetting();
openSetting(app);
event.preventDefault();
return;
}

View file

@ -26,6 +26,7 @@ import {initBar} from "../layout/topBar";
import {setProxy} from "../config/util/setProxy";
import {openChangelog} from "./openChangelog";
import {getIdFromSYProtocol, isSYProtocol} from "../util/pathName";
import {App} from "../index";
const matchKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {
if (key1 === "general") {
@ -84,7 +85,7 @@ const hasKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "edito
return match;
};
export const onGetConfig = (isStart: boolean) => {
export const onGetConfig = (isStart: boolean, app:App) => {
const matchKeymap1 = matchKeymap(Constants.SIYUAN_KEYMAP.general, "general");
const matchKeymap2 = matchKeymap(Constants.SIYUAN_KEYMAP.editor.general, "editor", "general");
const matchKeymap3 = matchKeymap(Constants.SIYUAN_KEYMAP.editor.insert, "editor", "insert");
@ -130,7 +131,7 @@ export const onGetConfig = (isStart: boolean) => {
if (!window.siyuan.config.uiLayout || (window.siyuan.config.uiLayout && !window.siyuan.config.uiLayout.left)) {
window.siyuan.config.uiLayout = Constants.SIYUAN_EMPTY_LAYOUT;
}
globalShortcut();
globalShortcut(app);
fetchPost("/api/system/getEmojiConf", {}, response => {
window.siyuan.emojis = response.data as IEmoji[];
try {
@ -140,7 +141,7 @@ export const onGetConfig = (isStart: boolean) => {
resetLayout();
}
});
initBar();
initBar(app);
setProxy();
initStatus();
initWindow();