Add context menu to select spelling language

This commit is contained in:
Yuya Ochiai
2017-04-27 00:42:48 +09:00
parent 3a9227f974
commit 256e317402
10 changed files with 103 additions and 44 deletions

View File

@@ -16,7 +16,9 @@ const MattermostView = React.createClass({
onUnreadCountChange: React.PropTypes.func,
src: React.PropTypes.string,
active: React.PropTypes.bool,
withTab: React.PropTypes.bool
withTab: React.PropTypes.bool,
useSpellChecker: React.PropTypes.bool,
onSelectSpellCheckerLocale: React.PropTypes.func
},
getInitialState() {
@@ -79,7 +81,15 @@ const MattermostView = React.createClass({
// webview.openDevTools();
if (!this.state.isContextMenuAdded) {
contextMenu.setup(webview);
contextMenu.setup(webview, {
useSpellChecker: this.props.useSpellChecker,
onSelectSpellCheckerLocale: (locale) => {
if (this.props.onSelectSpellCheckerLocale) {
this.props.onSelectSpellCheckerLocale(locale);
}
webview.send('set-spellcheker');
}
});
this.setState({isContextMenuAdded: true});
}
});