From: Greg Hurrell Date: Sun, 2 Aug 2015 05:34:47 +0000 (-0700) Subject: Tweak Field.react X-Git-Url: https://git.wincent.com/hextrapolate.git/commitdiff_plain/5edb1eaed51c94356ef7e65e8259e5d6f2cb870e?hp=a299b0625997ece0ccd7b180fa623ff6b2f6dc32;ds=sidebyside Tweak Field.react Edits for brevity, and add a title attribute to the copy link span. --- diff --git a/src/Field.react.js b/src/Field.react.js index ea757c5..5ff4be7 100644 --- a/src/Field.react.js +++ b/src/Field.react.js @@ -70,11 +70,10 @@ export default class Field extends React.Component { } _onCopy = () => { - const input = React.findDOMNode(this._input); - input.select(); + React.findDOMNode(this._input).select(); + // May throw a SecurityError. try { - // May throw a SecurityError. document.execCommand('copy'); } catch(error) { // eslint-disable-line no-empty // Swallow. @@ -86,7 +85,14 @@ export default class Field extends React.Component { // doesn't work; see: // - https://code.google.com/p/chromium/issues/detail?id=476508 // - https://github.com/w3c/clipboard-apis/issues/4 - return copy; + return ( + + copy + + ); } render() {