|
@@ -21,8 +21,11 @@ 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 {positionPDF, switchTabById} from "./global/function";
|
|
import {positionPDF, switchTabById} from "./global/function";
|
|
|
|
+import {loadPlugins} from "../plugin/loader";
|
|
|
|
|
|
class App {
|
|
class App {
|
|
|
|
+ public plugins: import("../plugin").Plugin[] = [];
|
|
|
|
+
|
|
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");
|
|
@@ -40,6 +43,9 @@ class App {
|
|
id: genUUID(),
|
|
id: genUUID(),
|
|
type: "main",
|
|
type: "main",
|
|
msgCallback: (data) => {
|
|
msgCallback: (data) => {
|
|
|
|
+ this.plugins.forEach((plugin) => {
|
|
|
|
+ plugin.eventBus.emit("ws-main", data);
|
|
|
|
+ });
|
|
if (data) {
|
|
if (data) {
|
|
switch (data.cmd) {
|
|
switch (data.cmd) {
|
|
case "syncMergeResult":
|
|
case "syncMergeResult":
|
|
@@ -128,6 +134,7 @@ class App {
|
|
window.siyuan.menus = new Menus();
|
|
window.siyuan.menus = new Menus();
|
|
fetchPost("/api/setting/getCloudUser", {}, userResponse => {
|
|
fetchPost("/api/setting/getCloudUser", {}, userResponse => {
|
|
window.siyuan.user = userResponse.data;
|
|
window.siyuan.user = userResponse.data;
|
|
|
|
+ loadPlugins(siyuanApp);
|
|
init();
|
|
init();
|
|
setTitle(window.siyuan.languages.siyuanNote);
|
|
setTitle(window.siyuan.languages.siyuanNote);
|
|
initMessage();
|
|
initMessage();
|
|
@@ -141,7 +148,7 @@ class App {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-new App();
|
|
|
|
|
|
+const siyuanApp = new App();
|
|
|
|
|
|
// 再次点击新窗口已打开的 PDF 时,需进行定位
|
|
// 再次点击新窗口已打开的 PDF 时,需进行定位
|
|
window.newWindow = {
|
|
window.newWindow = {
|