diff --git a/app/package.json b/app/package.json index 157d4153d..d15752227 100644 --- a/app/package.json +++ b/app/package.json @@ -61,7 +61,6 @@ "file-loader": "^6.2.0", "html-loader": "^2.1.2", "html-webpack-plugin": "^5.5.0", - "iconv-lite": "^0.6.3", "ifdef-loader": "^2.3.2", "mini-css-extract-plugin": "2.3.0", "path-browserify": "^1.0.1", diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml index bb5fa9837..5f385fb85 100644 --- a/app/pnpm-lock.yaml +++ b/app/pnpm-lock.yaml @@ -54,9 +54,6 @@ devDependencies: html-webpack-plugin: specifier: ^5.5.0 version: 5.5.0(webpack@5.73.0) - iconv-lite: - specifier: ^0.6.3 - version: 0.6.3 ifdef-loader: specifier: ^2.3.2 version: 2.3.2 diff --git a/app/src/plugin/index.ts b/app/src/plugin/index.ts index 07bc0377e..c8ae962e7 100644 --- a/app/src/plugin/index.ts +++ b/app/src/plugin/index.ts @@ -4,11 +4,11 @@ export class Plugin { } - getData () { + public getData () { } public onload() { - console.log("Hello, world!") + console.log("Hello, world!"); } } diff --git a/app/src/plugin/loader.ts b/app/src/plugin/loader.ts index 4bcb7717d..75b4f4c1f 100644 --- a/app/src/plugin/loader.ts +++ b/app/src/plugin/loader.ts @@ -10,27 +10,27 @@ const getObject = (key: string) => { }; // @ts-ignore return api[key]; -} +}; const runCode = (code: string, sourceURL: string) => { - return window.eval("(function anonymous(require, module){".concat(code, "\n})\n//# sourceURL=").concat(sourceURL, "\n")) -} + return window.eval("(function anonymous(require, module){".concat(code, "\n})\n//# sourceURL=").concat(sourceURL, "\n")); +}; export const loadPlugins = (app: App) => { fetchPost("/api/petal/loadPetals", {}, response => { let css = ""; response.data.forEach((item: { id: string, name: string, jsCode: string, cssCode: string, lang: IObject }) => { - const moduleObj = {} - const execResult = runCode(item.jsCode, "plugin:" + encodeURIComponent(item.id)) + const moduleObj = {}; + const execResult = runCode(item.jsCode, "plugin:" + encodeURIComponent(item.id)); execResult(getObject, moduleObj); // @ts-ignore - const plugin: Plugin = new moduleObj.exports.default({app, id: item.id, lang: item.lang}) + const plugin: Plugin = new moduleObj.exports.default({app, id: item.id, lang: item.lang}); app.plugins.push(plugin); plugin.onload(); css += item.cssCode + "\n"; - }) + }); const styleElement = document.createElement("style"); styleElement.textContent = css; document.head.append(styleElement); - }) -} + }); +}; diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts index de5f69995..882a6a11c 100644 --- a/app/src/protyle/wysiwyg/transaction.ts +++ b/app/src/protyle/wysiwyg/transaction.ts @@ -456,7 +456,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, focus: b protyle.title.element.setAttribute("custom-riff-decks", data.new["custom-riff-decks"]); setTimeout(() => { protyle.title.element.style.animation = ""; - }, 450) + }, 450); } else { protyle.title.element.removeAttribute("custom-riff-decks"); } @@ -492,7 +492,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, focus: b item.style.animation = "addCard 450ms linear"; setTimeout(() => { item.style.animation = ""; - }, 450) + }, 450); } }); const refElement = item.lastElementChild.querySelector(".protyle-attr--refcount");