This commit is contained in:
Vanessa 2023-06-30 10:44:33 +08:00
parent 65920afeeb
commit 4c7a01a911
6 changed files with 8 additions and 3 deletions

View file

@ -56,7 +56,7 @@ export const keymap = {
<span class="b3-list-item__toggle b3-list-item__toggle--hl"> <span class="b3-list-item__toggle b3-list-item__toggle--hl">
<svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg> <svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg>
</span> </span>
<span class="b3-list-item__text ft__on-surface">${item.name}</span> <span class="b3-list-item__text ft__on-surface">${item.displayName}</span>
</div> </div>
<div class="fn__none b3-list__panel"> <div class="fn__none b3-list__panel">
${commandHTML} ${commandHTML}

View file

@ -375,7 +375,7 @@ const openPlugin = (app: App, target: Element) => {
hasPlugin = true; hasPlugin = true;
menu.addItem({ menu.addItem({
icon: "iconSettings", icon: "iconSettings",
label: plugin.name, label: plugin.displayName,
click() { click() {
plugin.openSetting(); plugin.openSetting();
} }

View file

@ -23,7 +23,7 @@ export const commandPanel = (app: App) => {
plugin.commands.forEach(command => { plugin.commands.forEach(command => {
const liElement = document.createElement("li"); const liElement = document.createElement("li");
liElement.classList.add("b3-list-item"); liElement.classList.add("b3-list-item");
liElement.innerHTML = `<span class="b3-list-item__text">${command.langText || plugin.i18n[command.langKey]}</span> liElement.innerHTML = `<span class="b3-list-item__text">${plugin.displayName}: ${command.langText || plugin.i18n[command.langKey]}</span>
<span class="b3-list-item__meta">${updateHotkeyTip(command.customHotkey)}</span>`; <span class="b3-list-item__meta">${updateHotkeyTip(command.customHotkey)}</span>`;
liElement.addEventListener("click", () => { liElement.addEventListener("click", () => {
command.callback(); command.callback();

View file

@ -16,6 +16,7 @@ export class Plugin {
public i18n: IObject; public i18n: IObject;
public eventBus: EventBus; public eventBus: EventBus;
public data: any = {}; public data: any = {};
public displayName: string;
public name: string; public name: string;
public protyleSlash: { public protyleSlash: {
filter: string[], filter: string[],
@ -53,11 +54,13 @@ export class Plugin {
constructor(options: { constructor(options: {
app: App, app: App,
name: string, name: string,
displayName: string,
i18n: IObject i18n: IObject
}) { }) {
this.app = options.app; this.app = options.app;
this.i18n = options.i18n; this.i18n = options.i18n;
this.name = options.name; this.name = options.name;
this.displayName = options.displayName;
this.eventBus = new EventBus(options.name); this.eventBus = new EventBus(options.name);
} }

View file

@ -54,6 +54,7 @@ const loadPluginJS = async (app: App, item: IPluginData) => {
} }
const plugin = new pluginClass({ const plugin = new pluginClass({
app, app,
displayName: item.displayName,
name: item.name, name: item.name,
i18n: item.i18n i18n: item.i18n
}); });

View file

@ -341,6 +341,7 @@ interface ICommand {
} }
interface IPluginData { interface IPluginData {
displayName: string,
name: string, name: string,
js: string, js: string,
css: string, css: string,