mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 01:20:12 +01:00
Revert "Improve adaptive width for Attributes View (#9280)"
This reverts commit 2e46bee776.
This commit is contained in:
parent
2e46bee776
commit
f5da5b78c1
13 changed files with 204 additions and 199 deletions
|
|
@ -4,10 +4,18 @@ import {Plugin} from "./index";
|
|||
/// #if !MOBILE
|
||||
import {exportLayout, resizeTopBar} from "../layout/util";
|
||||
/// #endif
|
||||
import {PluginRequire} from "./require";
|
||||
import {API} from "./API";
|
||||
import {getFrontend, isMobile, isWindow} from "../util/functions";
|
||||
import {Constants} from "../constants";
|
||||
|
||||
const getObject = (key: string) => {
|
||||
const api = {
|
||||
siyuan: API
|
||||
};
|
||||
// @ts-ignore
|
||||
return api[key];
|
||||
};
|
||||
|
||||
const runCode = (code: string, sourceURL: string) => {
|
||||
return window.eval("(function anonymous(require, module, exports){".concat(code, "\n})\n//# sourceURL=").concat(sourceURL, "\n"));
|
||||
};
|
||||
|
|
@ -32,7 +40,7 @@ const loadPluginJS = async (app: App, item: IPluginData) => {
|
|||
const exportsObj: { [key: string]: any } = {};
|
||||
const moduleObj = {exports: exportsObj};
|
||||
try {
|
||||
runCode(item.js, "plugin:" + encodeURIComponent(item.name))(PluginRequire.require, moduleObj, exportsObj);
|
||||
runCode(item.js, "plugin:" + encodeURIComponent(item.name))(getObject, moduleObj, exportsObj);
|
||||
} catch (e) {
|
||||
console.error(`plugin ${item.name} run error:`, e);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue