mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-04 13:20:17 +00:00
Show Khoj Obsidian commands even if no connection to server
Server connection check can be a little flaky in Obsidian. Don't gate the commands behind it to improve usability of Khoj. Previously the commands would get disabled when server connection check failed, even though server was actually accessible
This commit is contained in:
@@ -16,33 +16,21 @@ export default class Khoj extends Plugin {
|
||||
this.addCommand({
|
||||
id: 'search',
|
||||
name: 'Search',
|
||||
checkCallback: (checking) => {
|
||||
if (!checking && this.settings.connectedToBackend)
|
||||
new KhojSearchModal(this.app, this.settings).open();
|
||||
return this.settings.connectedToBackend;
|
||||
}
|
||||
callback: () => { new KhojSearchModal(this.app, this.settings).open(); }
|
||||
});
|
||||
|
||||
// Add similar notes command. It can only be triggered from the editor
|
||||
this.addCommand({
|
||||
id: 'similar',
|
||||
name: 'Find similar notes',
|
||||
editorCheckCallback: (checking) => {
|
||||
if (!checking && this.settings.connectedToBackend)
|
||||
new KhojSearchModal(this.app, this.settings, true).open();
|
||||
return this.settings.connectedToBackend;
|
||||
}
|
||||
editorCallback: () => { new KhojSearchModal(this.app, this.settings, true).open(); }
|
||||
});
|
||||
|
||||
// Add chat command. It can be triggered from anywhere
|
||||
this.addCommand({
|
||||
id: 'chat',
|
||||
name: 'Chat',
|
||||
checkCallback: (checking) => {
|
||||
if (!checking && this.settings.connectedToBackend)
|
||||
new KhojChatModal(this.app, this.settings).open();
|
||||
return this.settings.connectedToBackend;
|
||||
}
|
||||
callback: () => { new KhojChatModal(this.app, this.settings).open(); }
|
||||
});
|
||||
|
||||
// Create an icon in the left ribbon.
|
||||
|
||||
Reference in New Issue
Block a user