diff --git a/src/main.ts b/src/main.ts index 7e73418..89ea3cc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -432,6 +432,12 @@ export default class PluginsAnnotations extends Plugin { } }; }, + installPlugin: (next: (repo: string, version: string, manifest: PluginManifest) => Promise) => { + return async function (this: Plugins, repo: string, version: string, manifest: PluginManifest): Promise { + await next.call(this, repo, version, manifest); + self.pluginNameToIdMap[manifest.name] = manifest.id; + }; + }, }); // Register the patch to ensure it gets cleaned up @@ -488,8 +494,6 @@ export default class PluginsAnnotations extends Plugin { async observeCommunityPluginsTab(tab: SettingTab) { - console.log("CALLED"); - // just in case, remove previous observers if there are any this.disconnectObservers(); diff --git a/src/types/obsidian-augment.d.ts b/src/types/obsidian-augment.d.ts index daeb3f2..831079e 100644 --- a/src/types/obsidian-augment.d.ts +++ b/src/types/obsidian-augment.d.ts @@ -58,6 +58,7 @@ declare module "obsidian" { plugins: Record; getPlugin(id: string): Plugin; uninstallPlugin(pluginId: string): Promise; + installPlugin(repo: string, version: string, manifest: PluginManifest): Promise } interface InternalPlugins {