From 580f4aca230ff5781b45d0c0ed19fc58f77ea136 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Tue, 10 Jan 2023 22:01:54 -0300 Subject: [PATCH] Add hints to Modal for available Keybindings --- src/interface/obsidian/src/modal.ts | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/interface/obsidian/src/modal.ts b/src/interface/obsidian/src/modal.ts index 7653c2bf..b72a0d30 100644 --- a/src/interface/obsidian/src/modal.ts +++ b/src/interface/obsidian/src/modal.ts @@ -1,4 +1,4 @@ -import { App, SuggestModal, Notice, request, MarkdownRenderer } from 'obsidian'; +import { App, SuggestModal, Notice, request, MarkdownRenderer, Instruction, Platform } from 'obsidian'; import { KhojSetting } from 'src/settings'; import { getVaultAbsolutePath } from 'src/utils'; @@ -27,6 +27,27 @@ export class KhojModal extends SuggestModal { }); this.rerank = false }); + + // Add Hints to Modal for available Keybindings + const modalInstructions: Instruction[] = [ + { + command: '↑↓', + purpose: 'to navigate', + }, + { + command: '↵', + purpose: 'to open', + }, + { + command: Platform.isMacOS ? 'cmd ↵': 'ctrl ↵', + purpose: 'to rerank', + }, + { + command: 'esc', + purpose: 'to dismiss', + }, + ] + this.setInstructions(modalInstructions); } async getSuggestions(query: string): Promise {