From 0ac4911b802554b15ee2c65924a5fc420a091cac Mon Sep 17 00:00:00 2001 From: Petyo Ivanov Date: Mon, 21 Aug 2023 15:08:52 +0300 Subject: [PATCH] fix: dialog button submit button press Fixes #41 Fixes #42 --- src/plugins/toolbar/primitives/DialogButton.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/toolbar/primitives/DialogButton.tsx b/src/plugins/toolbar/primitives/DialogButton.tsx index 34e325f9..702f5aa4 100644 --- a/src/plugins/toolbar/primitives/DialogButton.tsx +++ b/src/plugins/toolbar/primitives/DialogButton.tsx @@ -120,11 +120,6 @@ const DialogForm: React.FC<{ } }) - const onSubmitEH = (e: React.FormEvent) => { - e.preventDefault() - onSubmitCallback(selectedItem || '') - } - const onKeyDownEH = React.useCallback( (e: React.KeyboardEvent) => { if (e.key === 'Escape') { @@ -150,6 +145,11 @@ const DialogForm: React.FC<{ } } + const onSubmitEH = (e: React.FormEvent) => { + e.preventDefault() + onSubmitCallback((inputProps as { value: string }).value) + } + const dropdownIsVisible = isOpen && items.length > 0 return (