From 854549a38c5709effa47eced42ba9b26fa7c05e2 Mon Sep 17 00:00:00 2001 From: Andrea Alberti Date: Fri, 18 Oct 2024 22:11:30 +0200 Subject: [PATCH] - Fixed bug where a warning was shown when a new plugin was installed. --- src/main.ts | 8 ++++++-- src/types/obsidian-augment.d.ts | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) 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 {