Exit annotation editing mode when user leaves dashboard

pull/3087/head
Alex P 2018-03-28 12:36:57 -07:00
parent 60c304cf6a
commit bd1df4ba87
1 changed files with 8 additions and 0 deletions

View File

@ -28,6 +28,8 @@ import {
hideCellEditorOverlay,
} from 'src/dashboards/actions/cellEditorOverlay'
import {dismissEditingAnnotation} from 'src/shared/actions/annotations'
import {
setAutoRefresh,
templateControlBarVisibilityToggled as templateControlBarVisibilityToggledAction,
@ -109,6 +111,7 @@ class DashboardPage extends Component {
componentWillUnmount() {
window.removeEventListener('resize', this.handleWindowResize, true)
this.props.handleDismissEditingAnnotation()
}
inView = cell => {
@ -511,6 +514,7 @@ DashboardPage.propTypes = {
getAnnotationsAsync: func.isRequired,
handleShowCellEditorOverlay: func.isRequired,
handleHideCellEditorOverlay: func.isRequired,
handleDismissEditingAnnotation: func.isRequired,
selectedCell: shape({}),
thresholdsListType: string.isRequired,
thresholdsListColors: arrayOf(shape({}).isRequired).isRequired,
@ -587,6 +591,10 @@ const mapDispatchToProps = dispatch => ({
hideCellEditorOverlay,
dispatch
),
handleDismissEditingAnnotation: bindActionCreators(
dismissEditingAnnotation,
dispatch
),
})
export default connect(mapStateToProps, mapDispatchToProps)(