From 0bed410712f2537500fbbe4fad055ad46c613c8c Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Tue, 17 Jan 2023 19:34:48 -0300 Subject: [PATCH] Limit Find Similar Note command to be triggered from Editor Fixup indentation and comments --- src/interface/obsidian/src/main.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/interface/obsidian/src/main.ts b/src/interface/obsidian/src/main.ts index 98f1cbb6..7d464dd6 100644 --- a/src/interface/obsidian/src/main.ts +++ b/src/interface/obsidian/src/main.ts @@ -10,7 +10,7 @@ export default class Khoj extends Plugin { async onload() { await this.loadSettings(); - // Add a search command. It can be triggered from anywhere + // Add search command. It can be triggered from anywhere this.addCommand({ id: 'search', name: 'Search', @@ -21,11 +21,11 @@ export default class Khoj extends Plugin { } }); - // Add a similar notes command + // Add similar notes command. It can only be triggered from the editor this.addCommand({ id: 'similar', name: 'Find Similar Notes', - checkCallback: (checking) => { + editorCheckCallback: (checking) => { if (!checking && this.settings.connectedToBackend) new KhojModal(this.app, this.settings, true).open(); return this.settings.connectedToBackend; @@ -36,8 +36,8 @@ export default class Khoj extends Plugin { this.addRibbonIcon('search', 'Khoj', (_: MouseEvent) => { // Called when the user clicks the icon. this.settings.connectedToBackend - ? new KhojModal(this.app, this.settings).open() - : new Notice(`❗️Ensure Khoj backend is running and Khoj URL is pointing to it in the plugin settings`); + ? new KhojModal(this.app, this.settings).open() + : new Notice(`❗️Ensure Khoj backend is running and Khoj URL is pointing to it in the plugin settings`); }); // Add a settings tab so the user can configure khoj