1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-15 02:36:36 +00:00

add uncache button to article detail & change share dropdown seems to be native

This commit is contained in:
Rokt33r
2016-01-02 22:39:26 +09:00
parent bec0528a3a
commit 931f9bdce0
3 changed files with 117 additions and 38 deletions

View File

@@ -5,6 +5,10 @@ import clientKey from 'browser/lib/clientKey'
import activityRecord from 'browser/lib/activityRecord'
const clipboard = require('electron').clipboard
function notify (...args) {
return new window.Notification(...args)
}
function getDefault () {
return {
openDropdown: false,
@@ -66,6 +70,15 @@ export default class ShareButton extends React.Component {
this.setState({openDropdown: false})
}
handleClipboardButtonClick (e) {
activityRecord.emit('MAIN_DETAIL_COPY')
clipboard.writeText(this.props.article.content)
notify('Saved to Clipboard!', {
body: 'Paste it wherever you want!'
})
this.setState({openDropdown: false})
}
handleShareViaPublicURLClick (e) {
let { user } = this.props
let input = Object.assign({}, this.props.article, {
@@ -135,6 +148,9 @@ export default class ShareButton extends React.Component {
</div>
)
}
<button onClick={e => this.handleClipboardButtonClick(e)}>
<i className='fa fa-fw fa-clipboard'/>&nbsp;Copy to clipboard
</button>
</div>
</div>
)
@@ -143,7 +159,8 @@ export default class ShareButton extends React.Component {
ShareButton.propTypes = {
article: PropTypes.shape({
publicURL: PropTypes.string
publicURL: PropTypes.string,
content: PropTypes.string
}),
user: PropTypes.shape({
name: PropTypes.string