Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cancelling the popovers by clicking away #129

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions src/MUIRichTextEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,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