mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-06 21:29:12 +00:00
Limit Find Similar Note command to be triggered from Editor
Fixup indentation and comments
This commit is contained in:
@@ -10,7 +10,7 @@ export default class Khoj extends Plugin {
|
|||||||
async onload() {
|
async onload() {
|
||||||
await this.loadSettings();
|
await this.loadSettings();
|
||||||
|
|
||||||
// Add a search command. It can be triggered from anywhere
|
// Add search command. It can be triggered from anywhere
|
||||||
this.addCommand({
|
this.addCommand({
|
||||||
id: 'search',
|
id: 'search',
|
||||||
name: '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({
|
this.addCommand({
|
||||||
id: 'similar',
|
id: 'similar',
|
||||||
name: 'Find Similar Notes',
|
name: 'Find Similar Notes',
|
||||||
checkCallback: (checking) => {
|
editorCheckCallback: (checking) => {
|
||||||
if (!checking && this.settings.connectedToBackend)
|
if (!checking && this.settings.connectedToBackend)
|
||||||
new KhojModal(this.app, this.settings, true).open();
|
new KhojModal(this.app, this.settings, true).open();
|
||||||
return this.settings.connectedToBackend;
|
return this.settings.connectedToBackend;
|
||||||
@@ -36,8 +36,8 @@ export default class Khoj extends Plugin {
|
|||||||
this.addRibbonIcon('search', 'Khoj', (_: MouseEvent) => {
|
this.addRibbonIcon('search', 'Khoj', (_: MouseEvent) => {
|
||||||
// Called when the user clicks the icon.
|
// Called when the user clicks the icon.
|
||||||
this.settings.connectedToBackend
|
this.settings.connectedToBackend
|
||||||
? new KhojModal(this.app, this.settings).open()
|
? 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 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
|
// Add a settings tab so the user can configure khoj
|
||||||
|
|||||||
Reference in New Issue
Block a user