From b9c87a0ce35df97f3143b0527916ab61a2ae7c04 Mon Sep 17 00:00:00 2001 From: Red J Adaya Date: Sat, 24 Aug 2024 00:46:04 +0800 Subject: [PATCH] hide when Enter is pressed (#262) --- frontend/app/element/input.less | 2 +- frontend/app/modals/typeaheadmodal.less | 2 +- frontend/app/view/preview/preview.tsx | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/app/element/input.less b/frontend/app/element/input.less index 408675a2e..ca1d99ce0 100644 --- a/frontend/app/element/input.less +++ b/frontend/app/element/input.less @@ -7,7 +7,7 @@ border-radius: 6px; position: relative; min-height: 32px; - min-width: 200px; + min-width: 100px; gap: 6px; border: 2px solid var(--form-element-border-color); background: var(--form-element-bg-color); diff --git a/frontend/app/modals/typeaheadmodal.less b/frontend/app/modals/typeaheadmodal.less index d4a3b506d..4fc3636a4 100644 --- a/frontend/app/modals/typeaheadmodal.less +++ b/frontend/app/modals/typeaheadmodal.less @@ -50,7 +50,7 @@ display: flex; flex-direction: column; width: 100%; - min-width: 390px; + min-width: 100px; .label { opacity: 0.5; diff --git a/frontend/app/view/preview/preview.tsx b/frontend/app/view/preview/preview.tsx index 3f134b72c..756f0509c 100644 --- a/frontend/app/view/preview/preview.tsx +++ b/frontend/app/view/preview/preview.tsx @@ -653,7 +653,7 @@ function PreviewView({ blockId, model }: { blockId: string; model: PreviewModel }); return true; } - if (keyutil.checkKeyPressed(waveEvent, "Cmd:d")) { + if (keyutil.checkKeyPressed(waveEvent, "Cmd:d") || keyutil.checkKeyPressed(waveEvent, "Enter")) { globalStore.set(atoms.typeAheadModalAtom, { ...(typeAhead as TypeAheadModalType), [blockId]: false, @@ -687,6 +687,7 @@ function PreviewView({ blockId, model }: { blockId: string; model: PreviewModel anchor={contentRef} onKeyDown={(e) => keyutil.keydownWrapper(handleKeyDown)(e)} onSelect={handleFileSuggestionSelect} + onSubmit={(value) => console.log(value)} /> )}