mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-05 14:36:04 +00:00
Fix confirmation when closing media edition modal with unsaved changes (#26342)
This commit is contained in:
parent
93372fee1e
commit
b59053ff8c
|
@ -434,4 +434,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 }));
|
||||||
|
|
|
@ -97,14 +97,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 a new issue