1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-15 10:46:32 +00:00

Tooltip追加、キー反応改善、Pinch2Zoom使用禁止、Webpack config debug

This commit is contained in:
Rokt33r
2015-11-01 02:24:17 +09:00
parent ca79857386
commit d338f217fe
12 changed files with 144 additions and 34 deletions

View File

@@ -4,6 +4,32 @@ import ExternalLink from 'boost/components/ExternalLink'
import { setSearchFilter, clearSearch } from 'boost/actions'
export default class ArticleTopBar extends React.Component {
constructor (props) {
super(props)
this.state = {
isTooltipHidden: true
}
}
componentDidMount () {
this.searchInput = ReactDOM.findDOMNode(this.refs.searchInput)
}
componentWillUnmount () {
this.searchInput.removeEventListener('keydown', this.showTooltip)
this.searchInput.removeEventListener('focus', this.showTooltip)
this.searchInput.removeEventListener('blur', this.showTooltip)
}
handleTooltipRequest (e) {
if (this.searchInput.value.length === 0 && (document.activeElement === this.searchInput)) {
this.setState({isTooltipHidden: false})
} else {
this.setState({isTooltipHidden: true})
}
}
isInputFocused () {
return document.activeElement === ReactDOM.findDOMNode(this.refs.searchInput)
}
@@ -18,17 +44,18 @@ export default class ArticleTopBar extends React.Component {
}
focusInput () {
ReactDOM.findDOMNode(this.refs.searchInput).focus()
this.searchInput.focus()
}
blurInput () {
ReactDOM.findDOMNode(this.refs.searchInput).blur()
this.searchInput.blur()
}
handleSearchChange (e) {
let { dispatch } = this.props
dispatch(setSearchFilter(e.target.value))
this.handleTooltipRequest()
}
handleSearchClearButton (e) {
@@ -44,18 +71,31 @@ export default class ArticleTopBar extends React.Component {
<div className='left'>
<div className='search'>
<i className='fa fa-search fa-fw' />
<input ref='searchInput' value={this.props.status.search} onChange={e => this.handleSearchChange(e)} placeholder='Search' type='text'/>
<input
ref='searchInput'
onFocus={e => this.handleSearchChange(e)}
onBlur={e => this.handleSearchChange(e)}
value={this.props.status.search}
onChange={e => this.handleSearchChange(e)}
placeholder='Search'
type='text'
/>
{
this.props.status.search != null && this.props.status.search.length > 0
? <button onClick={e => this.handleSearchClearButton(e)} className='searchClearBtn'><i className='fa fa-times'/></button>
: null
}
<div className={'tooltip' + (this.state.isTooltipHidden ? ' hide' : '')}>
- Search by tag タグで検索 : #{'{string}'}<br/>
- Search by folder フォルダーで検索 : in:{'{folder_name}'}
</div>
</div>
</div>
<div className='right'>
<button>?</button>
<button>?<span className='tooltip'>How to use 使い方</span></button>
<ExternalLink className='logo' href='http://b00st.io'>
<img src='../../resources/favicon-230x230.png' width='44' height='44'/>
<span className='tooltip'>Boost official page 公式サイト</span>
</ExternalLink>
</div>
</div>