Skip to content

Commit

Permalink
fix: 修复菜单加载顺序问题导致的可能无法显示的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yuezhangcs committed Jul 31, 2023
1 parent e1afcd9 commit de27e0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Expand Up @@ -64,6 +64,6 @@ export default class PublisherPlugin extends Plugin {
// 预加载数据
this.cfg = await ConfigManager.loadConfig(this)
// 初始化菜单
this.topbar.initTopbar()
await this.topbar.initTopbar()
}
}
10 changes: 5 additions & 5 deletions src/topbar.ts
Expand Up @@ -50,14 +50,14 @@ export class Topbar {
this.widgetInvoke = new WidgetInvoke(pluginInstance)
}

public initTopbar() {
public async initTopbar() {
const quickMenus = await this.getQuickMenus()
const topBarElement = this.pluginInstance.addTopBar({
icon: icons.iconPlane,
title: this.pluginInstance.i18n.publishTool,
position: "left",
callback: async () => {
const quickMenus = await this.getQuickMenus()
await this.addMenu(topBarElement.getBoundingClientRect(), quickMenus)
callback: () => {
this.addMenu(topBarElement.getBoundingClientRect(), quickMenus)
},
})
}
Expand Down Expand Up @@ -90,7 +90,7 @@ export class Topbar {
return submenus
}

private async addMenu(rect: DOMRect, quickMenus: IMenuItemOption[]) {
private addMenu(rect: DOMRect, quickMenus: IMenuItemOption[]) {
const menu = new Menu("publisherMenu")

// 一键发布
Expand Down

0 comments on commit de27e0a

Please sign in to comment.