mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-10 08:54:40 +00:00
parent
abffbba819
commit
fa18859b20
|
@ -60,7 +60,8 @@ const messages = defineMessages({
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
hasComposingText: state.getIn(['compose', 'text']) !== '',
|
hasComposingText: state.getIn(['compose', 'text']).trim().length !== 0,
|
||||||
|
hasMediaAttachments: state.getIn(['compose', 'media_attachments']).size > 0,
|
||||||
layout: state.getIn(['local_settings', 'layout']),
|
layout: state.getIn(['local_settings', 'layout']),
|
||||||
isWide: state.getIn(['local_settings', 'stretch']),
|
isWide: state.getIn(['local_settings', 'stretch']),
|
||||||
navbarUnder: state.getIn(['local_settings', 'navbar_under']),
|
navbarUnder: state.getIn(['local_settings', 'navbar_under']),
|
||||||
|
@ -113,6 +114,7 @@ export default class UI extends React.Component {
|
||||||
navbarUnder: PropTypes.bool,
|
navbarUnder: PropTypes.bool,
|
||||||
isComposing: PropTypes.bool,
|
isComposing: PropTypes.bool,
|
||||||
hasComposingText: PropTypes.bool,
|
hasComposingText: PropTypes.bool,
|
||||||
|
hasMediaAttachments: PropTypes.bool,
|
||||||
match: PropTypes.object.isRequired,
|
match: PropTypes.object.isRequired,
|
||||||
location: PropTypes.object.isRequired,
|
location: PropTypes.object.isRequired,
|
||||||
history: PropTypes.object.isRequired,
|
history: PropTypes.object.isRequired,
|
||||||
|
@ -128,9 +130,9 @@ export default class UI extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
handleBeforeUnload = (e) => {
|
handleBeforeUnload = (e) => {
|
||||||
const { intl, hasComposingText } = this.props;
|
const { intl, hasComposingText, hasMediaAttachments } = this.props;
|
||||||
|
|
||||||
if (hasComposingText) {
|
if (hasComposingText || hasMediaAttachments) {
|
||||||
// Setting returnValue to any string causes confirmation dialog.
|
// Setting returnValue to any string causes confirmation dialog.
|
||||||
// Many browsers no longer display this text to users,
|
// Many browsers no longer display this text to users,
|
||||||
// but we set user-friendly message for other browsers, e.g. Edge.
|
// but we set user-friendly message for other browsers, e.g. Edge.
|
||||||
|
|
Loading…
Reference in a new issue