From a409b3e48d141acc566d4adc269f8b64cc7109e7 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Mon, 12 Jun 2017 21:44:29 +0900 Subject: [PATCH] Add notification on a copy button clicked --- browser/components/MarkdownPreview.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/browser/components/MarkdownPreview.js b/browser/components/MarkdownPreview.js index fa945c3d..6ec2aceb 100644 --- a/browser/components/MarkdownPreview.js +++ b/browser/components/MarkdownPreview.js @@ -286,6 +286,10 @@ export default class MarkdownPreview extends React.Component { copyIcon.innerHTML = '' copyIcon.onclick = (e) => { copy(content) + this.notify('Saved to Clipboard!', { + body: 'Paste it wherever you want!', + silent: true + }) } el.parentNode.appendChild(copyIcon) el.innerHTML = '' @@ -362,6 +366,13 @@ export default class MarkdownPreview extends React.Component { e.stopPropagation() } + notify (title, options) { + if (global.process.platform === 'win32') { + options.icon = path.join('file://', global.__dirname, '../../resources/app.png') + } + return new window.Notification(title, options) + } + render () { let { className, style, tabIndex } = this.props return (