Fixed broken ModeMenu mouse click

This commit is contained in:
jos 2017-01-10 20:14:26 +01:00
parent 07f92467e7
commit b730cb29bf
1 changed files with 9 additions and 11 deletions

View File

@ -16,7 +16,15 @@ export default class ModeMenu extends Component {
title: `Switch to ${mode} mode`, title: `Switch to ${mode} mode`,
className: 'jsoneditor-menu-button jsoneditor-type-modes' + className: 'jsoneditor-menu-button jsoneditor-type-modes' +
((mode === this.props.mode) ? ' jsoneditor-selected' : ''), ((mode === this.props.mode) ? ' jsoneditor-selected' : ''),
onClick: this.handleClick onClick: () => {
try {
this.props.onRequestClose()
this.props.onChangeMode(mode)
}
catch (err) {
this.props.onError(err)
}
}
}, toCapital(mode)) }, toCapital(mode))
}) })
@ -29,16 +37,6 @@ export default class ModeMenu extends Component {
} }
} }
handleClick = () => {
try {
this.props.onRequestClose()
this.props.onChangeMode(mode)
}
catch (err) {
this.props.onError(err)
}
}
componentDidMount () { componentDidMount () {
this.updateRequestCloseListener() this.updateRequestCloseListener()
} }