mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
FinderにCopy to clipboard button追加
This commit is contained in:
@@ -11,7 +11,16 @@ export default class FinderDetail extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<div className='FinderDetail'>
|
<div className='FinderDetail'>
|
||||||
<div className='header'>
|
<div className='header'>
|
||||||
<ModeIcon mode={activeArticle.mode}/> {activeArticle.title}</div>
|
<div className='left'>
|
||||||
|
<ModeIcon mode={activeArticle.mode}/> {activeArticle.title}
|
||||||
|
</div>
|
||||||
|
<div className='right'>
|
||||||
|
<button onClick={this.props.saveToClipboard} className='clipboardBtn'>
|
||||||
|
<i className='fa fa-clipboard fa-fw'/>
|
||||||
|
<span className='tooltip'>Copy to clipboard (Enter)</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div className='content'>
|
<div className='content'>
|
||||||
{activeArticle.mode === 'markdown'
|
{activeArticle.mode === 'markdown'
|
||||||
? <MarkdownPreview content={activeArticle.content}/>
|
? <MarkdownPreview content={activeArticle.content}/>
|
||||||
@@ -30,5 +39,6 @@ export default class FinderDetail extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FinderDetail.propTypes = {
|
FinderDetail.propTypes = {
|
||||||
activeArticle: PropTypes.shape()
|
activeArticle: PropTypes.shape(),
|
||||||
|
saveToClipboard: PropTypes.func
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
<title>CodeXen Popup</title>
|
<title>Boost Finder</title>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
|
||||||
|
|
||||||
|
|||||||
@@ -45,10 +45,7 @@ class FinderMain extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (e.keyCode === 13) {
|
if (e.keyCode === 13) {
|
||||||
let { activeArticle } = this.props
|
this.saveToClipboard()
|
||||||
clipboard.writeText(activeArticle.content)
|
|
||||||
activityRecord.emit('FINDER_COPY')
|
|
||||||
hideFinder()
|
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
}
|
}
|
||||||
if (e.keyCode === 27) {
|
if (e.keyCode === 27) {
|
||||||
@@ -57,6 +54,13 @@ class FinderMain extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveToClipboard () {
|
||||||
|
let { activeArticle } = this.props
|
||||||
|
clipboard.writeText(activeArticle.content)
|
||||||
|
activityRecord.emit('FINDER_COPY')
|
||||||
|
hideFinder()
|
||||||
|
}
|
||||||
|
|
||||||
handleSearchChange (e) {
|
handleSearchChange (e) {
|
||||||
let { dispatch } = this.props
|
let { dispatch } = this.props
|
||||||
|
|
||||||
@@ -83,6 +87,7 @@ class FinderMain extends React.Component {
|
|||||||
|
|
||||||
render () {
|
render () {
|
||||||
let { articles, activeArticle, status, dispatch } = this.props
|
let { articles, activeArticle, status, dispatch } = this.props
|
||||||
|
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)} onKeyDown={e => this.handleKeyDown(e)} className='Finder'>
|
||||||
<FinderInput
|
<FinderInput
|
||||||
@@ -98,7 +103,10 @@ class FinderMain extends React.Component {
|
|||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
selectArticle={article => this.selectArticle(article)}
|
selectArticle={article => this.selectArticle(article)}
|
||||||
/>
|
/>
|
||||||
<FinderDetail activeArticle={activeArticle}/>
|
<FinderDetail
|
||||||
|
activeArticle={activeArticle}
|
||||||
|
saveToClipboard={saveToClipboard}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,31 @@ body
|
|||||||
white-space nowrap
|
white-space nowrap
|
||||||
text-overflow ellipsis
|
text-overflow ellipsis
|
||||||
overflow-x hidden
|
overflow-x hidden
|
||||||
|
clearfix()
|
||||||
|
.left
|
||||||
|
float left
|
||||||
|
.right
|
||||||
|
float right
|
||||||
|
button
|
||||||
|
border-radius 16.5px
|
||||||
|
cursor pointer
|
||||||
|
height 33px
|
||||||
|
width 33px
|
||||||
|
border none
|
||||||
|
margin-right 5px
|
||||||
|
font-size 18px
|
||||||
|
color inactiveTextColor
|
||||||
|
background-color transparent
|
||||||
|
padding 0
|
||||||
|
.tooltip
|
||||||
|
tooltip()
|
||||||
|
&.clipboardBtn .tooltip
|
||||||
|
margin-left -160px
|
||||||
|
margin-top 25px
|
||||||
|
&:hover
|
||||||
|
color textColor
|
||||||
|
.tooltip
|
||||||
|
opacity 1
|
||||||
.content
|
.content
|
||||||
position absolute
|
position absolute
|
||||||
top 55px
|
top 55px
|
||||||
|
|||||||
Reference in New Issue
Block a user