Revert "Improve adaptive width for Attributes View (#9280)"

This reverts commit 2e46bee776.
This commit is contained in:
Vanessa 2023-11-09 17:00:55 +08:00
parent 2e46bee776
commit f5da5b78c1
13 changed files with 204 additions and 199 deletions

View file

@ -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;