Skip to content

Commit

Permalink
fix: dialog button submit button press
Browse files Browse the repository at this point in the history
Fixes #41
Fixes #42
  • Loading branch information
petyosi committed Aug 21, 2023
1 parent 823d1d3 commit 0ac4911
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/plugins/toolbar/primitives/DialogButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ const DialogForm: React.FC<{
}
})

const onSubmitEH = (e: React.FormEvent) => {
e.preventDefault()
onSubmitCallback(selectedItem || '')
}

const onKeyDownEH = React.useCallback(
(e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === 'Escape') {
Expand All @@ -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 (
<form onSubmit={onSubmitEH} className={classNames(styles.linkDialogEditForm)}>
Expand Down

0 comments on commit 0ac4911

Please sign in to comment.