Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

Commit

Permalink
fixed sidebar not trigger search
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeroX-DG committed Jul 4, 2018
1 parent cb656da commit 2a7f527
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ export default class SearchSnippetBar extends React.Component {
componentDidMount () {
eventEmitter.on('languageList:pickLang', (event, language) => {
const newKeyword = `lang:${language}`
this.refs.search.value = newKeyword
if (this.refs.search) {
this.refs.search.value = newKeyword
}
this.handleSearch(newKeyword)
})

eventEmitter.on('taglist:pickTag', (event, tag) => {
const newKeyword = `#${tag}`
this.refs.search.value = newKeyword
if (this.refs.search) {
this.refs.search.value = newKeyword
}
this.handleSearch(newKeyword)
})
}
Expand Down
8 changes: 6 additions & 2 deletions browser/render/layouts/original/search-snippet-bar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ export default class SearchSnippetBar extends React.Component {
componentDidMount () {
eventEmitter.on('languageList:pickLang', (event, language) => {
const newKeyword = `lang:${language}`
this.refs.search.value = newKeyword
if (this.refs.search) {
this.refs.search.value = newKeyword
}
this.handleSearch(newKeyword)
})

eventEmitter.on('taglist:pickTag', (event, tag) => {
const newKeyword = `#${tag}`
this.refs.search.value = newKeyword
if (this.refs.search) {
this.refs.search.value = newKeyword
}
this.handleSearch(newKeyword)
})
}
Expand Down

0 comments on commit 2a7f527

Please sign in to comment.