From 82d57eb574d773ac0987d786b2ad6ab4d66c551e Mon Sep 17 00:00:00 2001 From: jessop Date: Thu, 22 Aug 2019 21:32:09 -0400 Subject: [PATCH] copyableInput no longer uses electron clipboard --- src/ui/component/copyableText/view.jsx | 12 ++++++++++-- static/locales/en.json | 14 ++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/ui/component/copyableText/view.jsx b/src/ui/component/copyableText/view.jsx index 756af2fbd..74d8f67ea 100644 --- a/src/ui/component/copyableText/view.jsx +++ b/src/ui/component/copyableText/view.jsx @@ -1,7 +1,6 @@ // @flow import * as ICONS from 'constants/icons'; import * as React from 'react'; -import { clipboard } from 'electron'; import { FormField } from 'component/common/form'; import Button from 'component/button'; @@ -18,10 +17,19 @@ export default class CopyableText extends React.PureComponent { this.input = React.createRef(); (this: any).onFocus = this.onFocus.bind(this); + (this: any).copyToClipboard = this.copyToClipboard.bind(this); } input: { current: React.ElementRef }; + copyToClipboard() { + const topRef = this.input.current; + if (topRef && topRef.input && topRef.input.current) { + topRef.input.current.select(); + } + document.execCommand('copy'); + } + onFocus() { // We have to go a layer deep since the input is inside the form component const topRef = this.input.current; @@ -47,7 +55,7 @@ export default class CopyableText extends React.PureComponent { button="inverse" icon={ICONS.COPY} onClick={() => { - clipboard.writeText(copyable); + this.copyToClipboard(); doToast({ message: snackMessage || __('Text copied'), }); diff --git a/static/locales/en.json b/static/locales/en.json index d58bbd28b..f7f97da41 100644 --- a/static/locales/en.json +++ b/static/locales/en.json @@ -638,5 +638,15 @@ "For more details on backing up and best practices": "For more details on backing up and best practices", "File Size": "File Size", "You deposited 1 LBC as a support!": "You deposited 1 LBC as a support!", - "Refreshed!": "Refreshed!" -} + "Refreshed!": "Refreshed!", + "Starting...": "Starting...", + "Spin Spin Sugar": "Spin Spin Sugar", + "You're not following any channels.": "You're not following any channels.", + "Look what's trending for everyone": "Look what's trending for everyone", + "or": "or", + "Discover some channels!": "Discover some channels!", + "Trending": "Trending", + "Top": "Top", + "New": "New", + "Loading": "Loading" +} \ No newline at end of file