From 5a3bd545670b2d6b808167c9aed5d394b14b1e2f Mon Sep 17 00:00:00 2001 From: kometenstaub <83140328+kometenstaub@users.noreply.github.com> Date: Sat, 23 Mar 2024 10:55:01 +0100 Subject: [PATCH] fix: only show diff command when sync enabled --- src/interfaces.ts | 1 + src/main.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/interfaces.ts b/src/interfaces.ts index b1e0093..a00e0d1 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -11,6 +11,7 @@ declare module 'obsidian' { plugins: { sync: { instance: syncInstance; + enabled: boolean; }; 'file-recovery': { instance: fileRInstance; diff --git a/src/main.ts b/src/main.ts index e2a1e06..cce23b4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -41,7 +41,6 @@ export default class OpenSyncHistoryPlugin extends Plugin { new SyncDiffView(this, this.app, file).open(); } - giveCallback( fn: (file: TFile) => Promise | void ): Command['checkCallback'] { @@ -87,7 +86,9 @@ export default class OpenSyncHistoryPlugin extends Plugin { async onload() { console.log('loading Version History Diff plugin'); - this.addCommand(this.returnDiffCommand()); + if (this.app.internalPlugins.plugins.sync.enabled) { + this.addCommand(this.returnDiffCommand()); + } this.addCommand(this.returnRecoveryDiffCommand()); if (this.app.plugins.getPlugin('obsidian-git')) { this.addCommand(this.returnGitDiffCommand());