Skip to content

Commit

Permalink
Allow to cancel the popovers by clicking away
Browse files Browse the repository at this point in the history
  • Loading branch information
Tymen Steur committed Jun 9, 2020
1 parent 11e6a0c commit 0819012
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/MUIRichTextEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,7 @@ const MUIRichTextEditor: RefForwardingComponent<TMUIRichTextEditorRef, IMUIRichT
data={state.urlData}
anchor={state.anchorUrlPopover}
onConfirm={handleConfirmPrompt}
onCancel={dismissPopover}
isMedia={state.urlIsMedia}
/>
: null}
Expand Down
2 changes: 2 additions & 0 deletions src/components/UrlPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ interface IUrlPopoverStateProps extends WithStyles<typeof styles> {
data?: TUrlData
isMedia?: boolean
onConfirm: (isMedia?: boolean, ...args: any) => void
onCancel: () => void
}

const styles = ({ spacing }: Theme) => createStyles({
Expand Down Expand Up @@ -68,6 +69,7 @@ const UrlPopover: FunctionComponent<IUrlPopoverStateProps> = (props) => {
return (
<Popover
open={props.anchor !== undefined}
onClose={props.onCancel}
anchorEl={props.anchor}
anchorOrigin={{
vertical: "bottom",
Expand Down

0 comments on commit 0819012

Please sign in to comment.