|
|
@ -67,21 +67,25 @@ export default class MediaModal extends ImmutablePureComponent { |
|
|
|
|
|
|
|
|
|
|
|
componentDidMount () { |
|
|
|
componentDidMount () { |
|
|
|
window.addEventListener('keyup', this.handleKeyUp, false); |
|
|
|
window.addEventListener('keyup', this.handleKeyUp, false); |
|
|
|
|
|
|
|
if (this.context.router) { |
|
|
|
const history = this.context.router.history; |
|
|
|
const history = this.context.router.history; |
|
|
|
history.push(history.location.pathname, previewState); |
|
|
|
history.push(history.location.pathname, previewState); |
|
|
|
this.unlistenHistory = history.listen(() => { |
|
|
|
this.unlistenHistory = history.listen(() => { |
|
|
|
this.props.onClose(); |
|
|
|
this.props.onClose(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
componentWillUnmount () { |
|
|
|
componentWillUnmount () { |
|
|
|
window.removeEventListener('keyup', this.handleKeyUp); |
|
|
|
window.removeEventListener('keyup', this.handleKeyUp); |
|
|
|
|
|
|
|
if (this.context.router) { |
|
|
|
this.unlistenHistory(); |
|
|
|
this.unlistenHistory(); |
|
|
|
|
|
|
|
|
|
|
|
if (this.context.router.history.location.state === previewState) { |
|
|
|
if (this.context.router.history.location.state === previewState) { |
|
|
|
this.context.router.history.goBack(); |
|
|
|
this.context.router.history.goBack(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getIndex () { |
|
|
|
getIndex () { |
|
|
|
return this.state.index !== null ? this.state.index : this.props.index; |
|
|
|
return this.state.index !== null ? this.state.index : this.props.index; |
|
|
|