Skip to content

Commit

Permalink
fix: correct handling of nested forms
Browse files Browse the repository at this point in the history
  • Loading branch information
petyosi committed Oct 5, 2023
1 parent 1ca4924 commit a152e8a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/plugins/core/PropertyPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export const PropertyPopover: React.FC<PropertyPopoverProps> = ({ title, propert
onSubmit={(e) => {
void handleSubmit(onChange)(e)
setOpen(false)
e.nativeEvent.stopImmediatePropagation()
e.preventDefault()
e.stopPropagation()
}}
>
<h3 className={styles.propertyPanelTitle}>{title} Attributes</h3>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/frontmatter/FrontmatterEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const FrontmatterEditor = ({ yaml, onChange }: FrontmatterEditorProps) =>
<form
onSubmit={(e) => {
void handleSubmit(onSubmit)(e)
e.nativeEvent.stopImmediatePropagation()
e.stopPropagation()
}}
onReset={() => setFrontmatterDialogOpen(false)}
>
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/image/ImageDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export const ImageDialog: React.FC = () => {
onSubmit={(e) => {
void handleSubmit(saveImage)(e)
reset({ src: '', title: '', altText: '' })
e.nativeEvent.stopImmediatePropagation()
e.preventDefault()
e.stopPropagation()
}}
className={styles.multiFieldForm}
>
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/link-dialog/LinkDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export function LinkEditForm({ url, title, onSubmit, onCancel, linkAutocompleteS
<form
onSubmit={(e) => {
void handleSubmit(onSubmit)(e)
e.nativeEvent.stopImmediatePropagation()
e.stopPropagation()
e.preventDefault()
}}
onReset={onCancel}
className={classNames(styles.multiFieldForm, styles.linkDialogEditForm)}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/toolbar/primitives/DialogButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const DialogForm: React.FC<{

const onSubmitEH = (e: React.FormEvent) => {
e.preventDefault()
e.nativeEvent.stopImmediatePropagation()
e.stopPropagation()
onSubmitCallback((inputProps as { value: string }).value)
}

Expand Down

0 comments on commit a152e8a

Please sign in to comment.