diff options
| author | omagdy7 <omar.professional8777@gmail.com> | 2023-11-07 11:09:37 +0200 |
|---|---|---|
| committer | omagdy7 <omar.professional8777@gmail.com> | 2023-11-07 11:09:37 +0200 |
| commit | 58863b01677d2f71015defdf437a442275af38f8 (patch) | |
| tree | cd4011d35f80fc8640888af2a856c261fabcd4d6 /src/components/OllamaCommandPallete.tsx | |
| parent | b8b0805107e5ff312e958d612378305dbb770ac7 (diff) | |
| download | ollama-logseq-58863b01677d2f71015defdf437a442275af38f8.tar.xz ollama-logseq-58863b01677d2f71015defdf437a442275af38f8.zip | |
Added some quality of life changes like hitting esc would hide the ui and solved a bug where the UI wouldn't showup after calling summarize and other commands
Diffstat (limited to 'src/components/OllamaCommandPallete.tsx')
| -rw-r--r-- | src/components/OllamaCommandPallete.tsx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/components/OllamaCommandPallete.tsx b/src/components/OllamaCommandPallete.tsx index d48d392..0ee8097 100644 --- a/src/components/OllamaCommandPallete.tsx +++ b/src/components/OllamaCommandPallete.tsx @@ -17,12 +17,15 @@ export function OllamaCommandPallete({ options, theme }: { options: string[], th setIsEnterPressed(true); switch (selection) { case "divide into subtasks": + logseq.hideMainUI() DivideTaskIntoSubTasks() break; case "summarize": + logseq.hideMainUI() summarize() break; case "convert to flash card": + logseq.hideMainUI() convertToFlashCard() break; default: @@ -30,6 +33,20 @@ export function OllamaCommandPallete({ options, theme }: { options: string[], th } } + useEffect(() => { + const handleEsc = (e: any) => { + if (e.key === 'Escape') { + logseq.hideMainUI() + } + }; + + window.addEventListener('keydown', handleEsc); + + return () => { + window.removeEventListener('keydown', handleEsc); + }; + }, []); + if (isEnterPressed && (selection !== 'ask ai' && selection !== 'define' && selection !== 'ask with context')) { return null } |
