1
0
mirror of https://github.com/BoostIo/Boostnote synced 2026-02-18 18:28:49 +00:00

Key入力の動き改善

- Searchに内容がある時にEscを押すと内容をSearchの内容を削除する
- Cmd + Fを押すとSearch inputがfocusされる
This commit is contained in:
Rokt33r
2015-10-31 18:29:45 +09:00
parent 954e148be3
commit 60e551e273
3 changed files with 17 additions and 3 deletions

View File

@@ -1,13 +1,22 @@
import React, { PropTypes } from 'react'
import ReactDOM from 'react-dom'
import ExternalLink from 'boost/components/ExternalLink'
import { setSearchFilter } from 'boost/actions'
import { setSearchFilter, clearSearch } from 'boost/actions'
export default class ArticleTopBar extends React.Component {
isInputFocused () {
return document.activeElement === ReactDOM.findDOMNode(this.refs.searchInput)
}
escape () {
let { status, dispatch } = this.props
if (status.search.length > 0) {
dispatch(clearSearch())
return
}
this.blurInput()
}
focusInput () {
ReactDOM.findDOMNode(this.refs.searchInput).focus()
}