[Glitch] Fix confirmation when closing media edition modal with unsaved changes
Port b59053ff8c
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
pull/2368/head
parent
f0ad745506
commit
2f50b77ae8
|
@ -423,4 +423,4 @@ class FocalPointModal extends ImmutablePureComponent {
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps, null, {
|
export default connect(mapStateToProps, mapDispatchToProps, null, {
|
||||||
forwardRef: true,
|
forwardRef: true,
|
||||||
})(injectIntl(FocalPointModal, { withRef: true }));
|
})(injectIntl(FocalPointModal, { forwardRef: true }));
|
||||||
|
|
|
@ -105,14 +105,7 @@ export default class ModalRoot extends PureComponent {
|
||||||
|
|
||||||
handleClose = (ignoreFocus = false) => {
|
handleClose = (ignoreFocus = false) => {
|
||||||
const { onClose } = this.props;
|
const { onClose } = this.props;
|
||||||
let message = null;
|
const message = this._modal?.getCloseConfirmationMessage?.();
|
||||||
try {
|
|
||||||
message = this._modal?.getWrappedInstance?.().getCloseConfirmationMessage?.();
|
|
||||||
} catch (_) {
|
|
||||||
// injectIntl defines `getWrappedInstance` but errors out if `withRef`
|
|
||||||
// isn't set.
|
|
||||||
// This would be much smoother with react-intl 3+ and `forwardRef`.
|
|
||||||
}
|
|
||||||
onClose(message, ignoreFocus);
|
onClose(message, ignoreFocus);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue