mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
External link動きDebug
This commit is contained in:
@@ -42,12 +42,26 @@ export default class ArticleTopBar extends React.Component {
|
|||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
this.searchInput = ReactDOM.findDOMNode(this.refs.searchInput)
|
this.searchInput = ReactDOM.findDOMNode(this.refs.searchInput)
|
||||||
|
this.linksButton = ReactDOM.findDOMNode(this.refs.links)
|
||||||
|
this.showLinksDropdown = e => {
|
||||||
|
e.preventDefault()
|
||||||
|
e.stopPropagation()
|
||||||
|
if (!this.state.isLinksDropdownOpen) {
|
||||||
|
this.setState({isLinksDropdownOpen: true})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.linksButton.addEventListener('click', this.showLinksDropdown)
|
||||||
|
this.hideLinksDropdown = e => {
|
||||||
|
if (this.state.isLinksDropdownOpen) {
|
||||||
|
this.setState({isLinksDropdownOpen: false})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.addEventListener('click', this.hideLinksDropdown)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
componentWillUnmount () {
|
||||||
this.searchInput.removeEventListener('keydown', this.showTooltip)
|
document.removeEventListener('click', this.hideLinksDropdown)
|
||||||
this.searchInput.removeEventListener('focus', this.showTooltip)
|
this.linksButton.removeEventListener('click', this.showLinksDropdown())
|
||||||
this.searchInput.removeEventListener('blur', this.showTooltip)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleTooltipRequest (e) {
|
handleTooltipRequest (e) {
|
||||||
@@ -97,28 +111,6 @@ export default class ArticleTopBar extends React.Component {
|
|||||||
dispatch(toggleTutorial())
|
dispatch(toggleTutorial())
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLinksDropdownClick (e) {
|
|
||||||
e.preventDefault()
|
|
||||||
let linksButton = document.activeElement
|
|
||||||
this.handleLinksDropdownClickHandler = e => {
|
|
||||||
if (linksButton !== document.activeElement) {
|
|
||||||
console.log('hide dropdown')
|
|
||||||
document.removeEventListener('click', this.handleLinksDropdownClickHandler)
|
|
||||||
this.setState({
|
|
||||||
isLinksDropdownOpen: false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.state.isLinksDropdownOpen) {
|
|
||||||
document.removeEventListener('click', this.handleLinksDropdownClickHandler)
|
|
||||||
document.addEventListener('click', this.handleLinksDropdownClickHandler)
|
|
||||||
this.setState({
|
|
||||||
isLinksDropdownOpen: true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
let { status } = this.props
|
let { status } = this.props
|
||||||
return (
|
return (
|
||||||
@@ -155,7 +147,7 @@ export default class ArticleTopBar extends React.Component {
|
|||||||
<div className='right'>
|
<div className='right'>
|
||||||
<button onClick={e => this.handleTutorialButtonClick(e)}>?<span className='tooltip'>How to use</span>
|
<button onClick={e => this.handleTutorialButtonClick(e)}>?<span className='tooltip'>How to use</span>
|
||||||
</button>
|
</button>
|
||||||
<a className='linksBtn' onClick={e => this.handleLinksDropdownClick(e)} href>
|
<a ref='links' className='linksBtn' href>
|
||||||
<img src='../../resources/favicon-230x230.png' width='44' height='44'/>
|
<img src='../../resources/favicon-230x230.png' width='44' height='44'/>
|
||||||
</a>
|
</a>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user