Skip to content

Commit

Permalink
🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuoqiu-Yingyi committed Nov 21, 2023
1 parent 46f3cea commit 30b75a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions app/src/config/bazaar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {Plugin} from "../plugin";
import {App} from "../index";
import {escapeAttr} from "../util/escape";
import {uninstall} from "../plugin/uninstall";
import {afterLoadPlugin, loadPlugin, loadPlugins} from "../plugin/loader";
import {afterLoadPlugin, loadPetals, loadPlugin, loadPlugins} from "../plugin/loader";

export const bazaar = {
element: undefined as Element,
Expand Down Expand Up @@ -794,7 +794,7 @@ export const bazaar = {
if (!target.getAttribute("disabled")) {
target.setAttribute("disabled", "disabled");
window.siyuan.config.bazaar.petalDisabled = !(target as HTMLInputElement).checked;
fetchPost("/api/setting/setBazaar", window.siyuan.config.bazaar, () => {
fetchPost("/api/setting/setBazaar", window.siyuan.config.bazaar, async () => {
target.removeAttribute("disabled");
if (window.siyuan.config.bazaar.petalDisabled) {
bazaar.element.querySelectorAll("#configBazaarDownloaded .b3-card").forEach(item => {
Expand All @@ -805,7 +805,8 @@ export const bazaar = {
bazaar.element.querySelectorAll("#configBazaarDownloaded .b3-card").forEach(item => {
item.classList.remove("b3-card--disabled");
});
loadPlugins(app).then(() => {
const plugins = await loadPetals();
await loadPlugins(app, plugins).then(() => {
app.plugins.forEach(item => {
afterLoadPlugin(item);
});
Expand Down
4 changes: 2 additions & 2 deletions app/src/plugin/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ const mergePluginHotkey = (plugin: Plugin) => {
}
};

export const afterLoadPlugin = (plugin: Plugin) => {
export const afterLoadPlugin = async (plugin: Plugin) => {
try {
plugin.onLayoutReady();
await plugin.onLayoutReady();
} catch (e) {
console.error(`plugin ${plugin.name} onLayoutReady error:`, e);
}
Expand Down

0 comments on commit 30b75a4

Please sign in to comment.