mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Add comments
This commit is contained in:
@@ -44,11 +44,12 @@ class TopBar extends React.Component {
|
|||||||
isIME: false
|
isIME: false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// When the key is an alphabet, del, enter or ctr
|
||||||
if (e.keyCode <= 90) {
|
if (e.keyCode <= 90) {
|
||||||
this.setState({
|
this.setState({
|
||||||
isAlphabet: true,
|
isAlphabet: true
|
||||||
isIME: false
|
|
||||||
})
|
})
|
||||||
|
// When the key is an IME input (Japanese, Chinese)
|
||||||
} else if (e.keyCode === 229) {
|
} else if (e.keyCode === 229) {
|
||||||
this.setState({
|
this.setState({
|
||||||
isIME: true
|
isIME: true
|
||||||
@@ -58,6 +59,12 @@ class TopBar extends React.Component {
|
|||||||
|
|
||||||
|
|
||||||
handleKeyUp (e) {
|
handleKeyUp (e) {
|
||||||
|
// reset states
|
||||||
|
this.setState({
|
||||||
|
isConfirmTranslation: false
|
||||||
|
})
|
||||||
|
|
||||||
|
// When the key is translation confirmation (Enter)
|
||||||
if (this.state.isIME && e.keyCode === 13) {
|
if (this.state.isIME && e.keyCode === 13) {
|
||||||
this.setState({
|
this.setState({
|
||||||
isConfirmTranslation: true
|
isConfirmTranslation: true
|
||||||
@@ -67,10 +74,6 @@ class TopBar extends React.Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
search: this.refs.searchInput.value
|
search: this.refs.searchInput.value
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
this.setState({
|
|
||||||
isConfirmTranslation: false
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user