1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

enable copy (finder)

This commit is contained in:
Rokt33r
2015-12-13 18:36:31 +09:00
parent a05f5b9737
commit 57912b5a5a

View File

@@ -32,11 +32,13 @@ class FinderMain extends React.Component {
} }
componentDidMount () { componentDidMount () {
this.keyDownHandler = e => this.handleKeyDown(e)
document.addEventListener('keydown', this.keyDownHandler)
ReactDOM.findDOMNode(this.refs.finderInput.refs.input).focus() ReactDOM.findDOMNode(this.refs.finderInput.refs.input).focus()
} }
handleClick (e) { componentWillUnmount () {
ReactDOM.findDOMNode(this.refs.finderInput.refs.input).focus() document.removeEventListener('keydown', this.keyDownHandler)
} }
handleKeyDown (e) { handleKeyDown (e) {
@@ -58,6 +60,11 @@ class FinderMain extends React.Component {
hideFinder() hideFinder()
e.preventDefault() e.preventDefault()
} }
if (e.keyCode === 91 || e.metaKey) {
return
}
ReactDOM.findDOMNode(this.refs.finderInput.refs.input).focus()
} }
saveToClipboard () { saveToClipboard () {
@@ -99,7 +106,7 @@ class FinderMain extends React.Component {
let { articles, activeArticle, status, dispatch } = this.props let { articles, activeArticle, status, dispatch } = this.props
let saveToClipboard = () => this.saveToClipboard() let saveToClipboard = () => this.saveToClipboard()
return ( return (
<div onClick={e => this.handleClick(e)} onKeyDown={e => this.handleKeyDown(e)} className='Finder'> <div onClick={e => this.handleClick(e)} className='Finder'>
<FinderInput <FinderInput
handleSearchChange={e => this.handleSearchChange(e)} handleSearchChange={e => this.handleSearchChange(e)}
ref='finderInput' ref='finderInput'