mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 01:50:12 +01:00
This commit is contained in:
parent
f46e0d48ad
commit
b8f56f4a1d
7 changed files with 20 additions and 20 deletions
|
|
@ -215,7 +215,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!protyle) {
|
if (!protyle && item.editors.length > 0) {
|
||||||
protyle = item.editors[0].protyle;
|
protyle = item.editors[0].protyle;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import {App} from "../index";
|
||||||
import {initWindowEvent} from "./globalEvent/event";
|
import {initWindowEvent} from "./globalEvent/event";
|
||||||
import {sendGlobalShortcut} from "./globalEvent/keydown";
|
import {sendGlobalShortcut} from "./globalEvent/keydown";
|
||||||
import {closeWindow} from "../window/closeWin";
|
import {closeWindow} from "../window/closeWin";
|
||||||
|
import {loadPlugins} from "../plugin/loader";
|
||||||
|
|
||||||
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") {
|
||||||
|
|
@ -87,7 +88,7 @@ const hasKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "edito
|
||||||
return match;
|
return match;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const onGetConfig = (isStart: boolean, app: App) => {
|
export const onGetConfig = async (isStart: boolean, app: App) => {
|
||||||
const matchKeymap1 = matchKeymap(Constants.SIYUAN_KEYMAP.general, "general");
|
const matchKeymap1 = matchKeymap(Constants.SIYUAN_KEYMAP.general, "general");
|
||||||
const matchKeymap2 = matchKeymap(Constants.SIYUAN_KEYMAP.editor.general, "editor", "general");
|
const matchKeymap2 = matchKeymap(Constants.SIYUAN_KEYMAP.editor.general, "editor", "general");
|
||||||
const matchKeymap3 = matchKeymap(Constants.SIYUAN_KEYMAP.editor.insert, "editor", "insert");
|
const matchKeymap3 = matchKeymap(Constants.SIYUAN_KEYMAP.editor.insert, "editor", "insert");
|
||||||
|
|
@ -140,8 +141,9 @@ export const onGetConfig = (isStart: boolean, app: App) => {
|
||||||
initWindow(app);
|
initWindow(app);
|
||||||
appearance.onSetappearance(window.siyuan.config.appearance);
|
appearance.onSetappearance(window.siyuan.config.appearance);
|
||||||
initAssets();
|
initAssets();
|
||||||
renderSnippet();
|
|
||||||
setInlineStyle();
|
setInlineStyle();
|
||||||
|
await loadPlugins(app);
|
||||||
|
renderSnippet();
|
||||||
let resizeTimeout = 0;
|
let resizeTimeout = 0;
|
||||||
window.addEventListener("resize", () => {
|
window.addEventListener("resize", () => {
|
||||||
window.clearTimeout(resizeTimeout);
|
window.clearTimeout(resizeTimeout);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import {getAllTabs} from "./layout/getAll";
|
||||||
import {getLocalStorage} from "./protyle/util/compatibility";
|
import {getLocalStorage} from "./protyle/util/compatibility";
|
||||||
import {getSearch} from "./util/functions";
|
import {getSearch} from "./util/functions";
|
||||||
import {hideAllElements} from "./protyle/ui/hideElements";
|
import {hideAllElements} from "./protyle/ui/hideElements";
|
||||||
import {loadPlugins} from "./plugin/loader";
|
|
||||||
import "./assets/scss/base.scss";
|
import "./assets/scss/base.scss";
|
||||||
|
|
||||||
export class App {
|
export class App {
|
||||||
|
|
@ -147,7 +146,7 @@ export class App {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchPost("/api/system/getConf", {}, async (response) => {
|
fetchPost("/api/system/getConf", {}, (response) => {
|
||||||
window.siyuan.config = response.data.conf;
|
window.siyuan.config = response.data.conf;
|
||||||
// 历史数据兼容,202306后可删除
|
// 历史数据兼容,202306后可删除
|
||||||
if (window.siyuan.config.uiLayout.left && !window.siyuan.config.uiLayout.left.data) {
|
if (window.siyuan.config.uiLayout.left && !window.siyuan.config.uiLayout.left.data) {
|
||||||
|
|
@ -164,7 +163,6 @@ export class App {
|
||||||
data: response.data.conf.uiLayout.bottom
|
data: response.data.conf.uiLayout.bottom
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
await loadPlugins(this);
|
|
||||||
getLocalStorage(() => {
|
getLocalStorage(() => {
|
||||||
fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
|
fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
|
||||||
window.siyuan.languages = lauguages;
|
window.siyuan.languages = lauguages;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ import {Menu} from "../plugin/Menu";
|
||||||
|
|
||||||
class App {
|
class App {
|
||||||
public plugins: import("../plugin").Plugin[] = [];
|
public plugins: import("../plugin").Plugin[] = [];
|
||||||
public appId:string;
|
public appId: string;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
if (!window.webkit?.messageHandlers && !window.JSAndroid) {
|
if (!window.webkit?.messageHandlers && !window.JSAndroid) {
|
||||||
|
|
@ -38,7 +38,7 @@ class App {
|
||||||
addScriptSync(`${Constants.PROTYLE_CDN}/js/lute/lute.min.js?v=${Constants.SIYUAN_VERSION}`, "protyleLuteScript");
|
addScriptSync(`${Constants.PROTYLE_CDN}/js/lute/lute.min.js?v=${Constants.SIYUAN_VERSION}`, "protyleLuteScript");
|
||||||
addScript(`${Constants.PROTYLE_CDN}/js/protyle-html.js?v=${Constants.SIYUAN_VERSION}`, "protyleWcHtmlScript");
|
addScript(`${Constants.PROTYLE_CDN}/js/protyle-html.js?v=${Constants.SIYUAN_VERSION}`, "protyleWcHtmlScript");
|
||||||
addBaseURL();
|
addBaseURL();
|
||||||
this.appId =Constants.SIYUAN_APPID;
|
this.appId = Constants.SIYUAN_APPID;
|
||||||
window.siyuan = {
|
window.siyuan = {
|
||||||
zIndex: 10,
|
zIndex: 10,
|
||||||
notebooks: [],
|
notebooks: [],
|
||||||
|
|
@ -80,10 +80,9 @@ class App {
|
||||||
window.addEventListener("pagehide", () => {
|
window.addEventListener("pagehide", () => {
|
||||||
saveScroll(window.siyuan.mobile.editor.protyle);
|
saveScroll(window.siyuan.mobile.editor.protyle);
|
||||||
}, false);
|
}, false);
|
||||||
fetchPost("/api/system/getConf", {}, async (confResponse) => {
|
fetchPost("/api/system/getConf", {}, (confResponse) => {
|
||||||
confResponse.data.conf.keymap = Constants.SIYUAN_KEYMAP;
|
confResponse.data.conf.keymap = Constants.SIYUAN_KEYMAP;
|
||||||
window.siyuan.config = confResponse.data.conf;
|
window.siyuan.config = confResponse.data.conf;
|
||||||
await loadPlugins(this);
|
|
||||||
getLocalStorage(() => {
|
getLocalStorage(() => {
|
||||||
fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
|
fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
|
||||||
window.siyuan.languages = lauguages;
|
window.siyuan.languages = lauguages;
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,11 @@ import {activeBlur, hideKeyboardToolbar, initKeyboardToolbar} from "./keyboardTo
|
||||||
import {syncGuide} from "../../sync/syncGuide";
|
import {syncGuide} from "../../sync/syncGuide";
|
||||||
import {Inbox} from "../../layout/dock/Inbox";
|
import {Inbox} from "../../layout/dock/Inbox";
|
||||||
import {App} from "../../index";
|
import {App} from "../../index";
|
||||||
|
import {loadPlugins} from "../../plugin/loader";
|
||||||
|
|
||||||
export const initFramework = (app: App) => {
|
export const initFramework = async (app: App) => {
|
||||||
setInlineStyle();
|
setInlineStyle();
|
||||||
|
await loadPlugins(this);
|
||||||
renderSnippet();
|
renderSnippet();
|
||||||
initKeyboardToolbar();
|
initKeyboardToolbar();
|
||||||
const sidebarElement = document.getElementById("sidebar");
|
const sidebarElement = document.getElementById("sidebar");
|
||||||
|
|
|
||||||
|
|
@ -19,17 +19,16 @@ import {initMessage} from "../dialog/message";
|
||||||
import {getAllTabs} from "../layout/getAll";
|
import {getAllTabs} from "../layout/getAll";
|
||||||
import {getLocalStorage} from "../protyle/util/compatibility";
|
import {getLocalStorage} from "../protyle/util/compatibility";
|
||||||
import {init} from "../window/init";
|
import {init} from "../window/init";
|
||||||
import {loadPlugins} from "../plugin/loader";
|
|
||||||
|
|
||||||
class App {
|
class App {
|
||||||
public plugins: import("../plugin").Plugin[] = [];
|
public plugins: import("../plugin").Plugin[] = [];
|
||||||
public appId:string;
|
public appId: string;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
addScriptSync(`${Constants.PROTYLE_CDN}/js/lute/lute.min.js?v=${Constants.SIYUAN_VERSION}`, "protyleLuteScript");
|
addScriptSync(`${Constants.PROTYLE_CDN}/js/lute/lute.min.js?v=${Constants.SIYUAN_VERSION}`, "protyleLuteScript");
|
||||||
addScript(`${Constants.PROTYLE_CDN}/js/protyle-html.js?v=${Constants.SIYUAN_VERSION}`, "protyleWcHtmlScript");
|
addScript(`${Constants.PROTYLE_CDN}/js/protyle-html.js?v=${Constants.SIYUAN_VERSION}`, "protyleWcHtmlScript");
|
||||||
addBaseURL();
|
addBaseURL();
|
||||||
this.appId =Constants.SIYUAN_APPID;
|
this.appId = Constants.SIYUAN_APPID;
|
||||||
window.siyuan = {
|
window.siyuan = {
|
||||||
zIndex: 10,
|
zIndex: 10,
|
||||||
transactions: [],
|
transactions: [],
|
||||||
|
|
@ -128,9 +127,8 @@ class App {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
fetchPost("/api/system/getConf", {}, async (response) => {
|
fetchPost("/api/system/getConf", {}, (response) => {
|
||||||
window.siyuan.config = response.data.conf;
|
window.siyuan.config = response.data.conf;
|
||||||
await loadPlugins(this);
|
|
||||||
getLocalStorage(() => {
|
getLocalStorage(() => {
|
||||||
fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
|
fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
|
||||||
window.siyuan.languages = lauguages;
|
window.siyuan.languages = lauguages;
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,11 @@ import {renderSnippet} from "../config/util/snippets";
|
||||||
import {getSearch} from "../util/functions";
|
import {getSearch} from "../util/functions";
|
||||||
import {initWindow} from "../boot/onGetConfig";
|
import {initWindow} from "../boot/onGetConfig";
|
||||||
import {App} from "../index";
|
import {App} from "../index";
|
||||||
import {afterLoadPlugin} from "../plugin/loader";
|
import {afterLoadPlugin, loadPlugins} from "../plugin/loader";
|
||||||
import {Tab} from "../layout/Tab";
|
import {Tab} from "../layout/Tab";
|
||||||
import {initWindowEvent} from "../boot/globalEvent/event";
|
import {initWindowEvent} from "../boot/globalEvent/event";
|
||||||
|
|
||||||
export const init = (app: App) => {
|
export const init = async (app: App) => {
|
||||||
webFrame.setZoomFactor(window.siyuan.storage[Constants.LOCAL_ZOOM]);
|
webFrame.setZoomFactor(window.siyuan.storage[Constants.LOCAL_ZOOM]);
|
||||||
initWindowEvent(app);
|
initWindowEvent(app);
|
||||||
fetchPost("/api/system/getEmojiConf", {}, response => {
|
fetchPost("/api/system/getEmojiConf", {}, response => {
|
||||||
|
|
@ -47,8 +47,9 @@ export const init = (app: App) => {
|
||||||
initWindow(app);
|
initWindow(app);
|
||||||
appearance.onSetappearance(window.siyuan.config.appearance);
|
appearance.onSetappearance(window.siyuan.config.appearance);
|
||||||
initAssets();
|
initAssets();
|
||||||
renderSnippet();
|
|
||||||
setInlineStyle();
|
setInlineStyle();
|
||||||
|
await loadPlugins(app);
|
||||||
|
renderSnippet();
|
||||||
let resizeTimeout = 0;
|
let resizeTimeout = 0;
|
||||||
window.addEventListener("resize", () => {
|
window.addEventListener("resize", () => {
|
||||||
window.clearTimeout(resizeTimeout);
|
window.clearTimeout(resizeTimeout);
|
||||||
|
|
@ -58,7 +59,7 @@ export const init = (app: App) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const afterLayout = (app:App) => {
|
const afterLayout = (app: App) => {
|
||||||
app.plugins.forEach(item => {
|
app.plugins.forEach(item => {
|
||||||
afterLoadPlugin(item);
|
afterLoadPlugin(item);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue