diff --git a/app/src/config/keymap.ts b/app/src/config/keymap.ts index 29378196a..cdc7d6e37 100644 --- a/app/src/config/keymap.ts +++ b/app/src/config/keymap.ts @@ -56,7 +56,7 @@ export const keymap = { - ${item.name} + ${item.displayName}
${commandHTML} diff --git a/app/src/layout/topBar.ts b/app/src/layout/topBar.ts index 0d48e5618..2eb76da59 100644 --- a/app/src/layout/topBar.ts +++ b/app/src/layout/topBar.ts @@ -375,7 +375,7 @@ const openPlugin = (app: App, target: Element) => { hasPlugin = true; menu.addItem({ icon: "iconSettings", - label: plugin.name, + label: plugin.displayName, click() { plugin.openSetting(); } diff --git a/app/src/plugin/commandPanel.ts b/app/src/plugin/commandPanel.ts index 17354035a..a6b5b20f5 100644 --- a/app/src/plugin/commandPanel.ts +++ b/app/src/plugin/commandPanel.ts @@ -23,7 +23,7 @@ export const commandPanel = (app: App) => { plugin.commands.forEach(command => { const liElement = document.createElement("li"); liElement.classList.add("b3-list-item"); - liElement.innerHTML = `${command.langText || plugin.i18n[command.langKey]} + liElement.innerHTML = `${plugin.displayName}: ${command.langText || plugin.i18n[command.langKey]} ${updateHotkeyTip(command.customHotkey)}`; liElement.addEventListener("click", () => { command.callback(); diff --git a/app/src/plugin/index.ts b/app/src/plugin/index.ts index 0721db474..17e6f88a1 100644 --- a/app/src/plugin/index.ts +++ b/app/src/plugin/index.ts @@ -16,6 +16,7 @@ export class Plugin { public i18n: IObject; public eventBus: EventBus; public data: any = {}; + public displayName: string; public name: string; public protyleSlash: { filter: string[], @@ -53,11 +54,13 @@ export class Plugin { constructor(options: { app: App, name: string, + displayName: string, i18n: IObject }) { this.app = options.app; this.i18n = options.i18n; this.name = options.name; + this.displayName = options.displayName; this.eventBus = new EventBus(options.name); } diff --git a/app/src/plugin/loader.ts b/app/src/plugin/loader.ts index e31d3ab06..bf578f979 100644 --- a/app/src/plugin/loader.ts +++ b/app/src/plugin/loader.ts @@ -54,6 +54,7 @@ const loadPluginJS = async (app: App, item: IPluginData) => { } const plugin = new pluginClass({ app, + displayName: item.displayName, name: item.name, i18n: item.i18n }); diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index 787b500c6..bd37e33a8 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -341,6 +341,7 @@ interface ICommand { } interface IPluginData { + displayName: string, name: string, js: string, css: string,