Fixed broken ModeMenu mouse click
This commit is contained in:
parent
07f92467e7
commit
b730cb29bf
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue