mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
♻️
This commit is contained in:
parent
5c5f7da1e6
commit
47d06a6309
1 changed files with 4 additions and 3 deletions
|
|
@ -8,10 +8,10 @@ import {API} from "./API";
|
||||||
import {getFrontend, isMobile, isWindow} from "../util/functions";
|
import {getFrontend, isMobile, isWindow} from "../util/functions";
|
||||||
import {Constants} from "../constants";
|
import {Constants} from "../constants";
|
||||||
|
|
||||||
const modules = {
|
|
||||||
siyuan: API
|
|
||||||
};
|
|
||||||
const requireFunc = (key: string) => {
|
const requireFunc = (key: string) => {
|
||||||
|
const modules = {
|
||||||
|
siyuan: API
|
||||||
|
};
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return modules[key]
|
return modules[key]
|
||||||
?? window.require?.(key);
|
?? window.require?.(key);
|
||||||
|
|
@ -44,6 +44,7 @@ const loadPluginJS = async (app: App, item: IPluginData) => {
|
||||||
const exportsObj: { [key: string]: any } = {};
|
const exportsObj: { [key: string]: any } = {};
|
||||||
const moduleObj = {exports: exportsObj};
|
const moduleObj = {exports: exportsObj};
|
||||||
try {
|
try {
|
||||||
|
debugger
|
||||||
runCode(item.js, "plugin:" + encodeURIComponent(item.name))(requireFunc, moduleObj, exportsObj);
|
runCode(item.js, "plugin:" + encodeURIComponent(item.name))(requireFunc, moduleObj, exportsObj);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`plugin ${item.name} run error:`, e);
|
console.error(`plugin ${item.name} run error:`, e);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue