You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2015/10/01 14:59:37 UTC

[3/4] fauxton commit: updated refs/heads/master to ebd9ced

fix loading of zeroclipboard

the swf was not loaded when no change to the element happened, e.g.
a static element.

additionally add a simple callback function to confirm a copy

PR: #535
PR-URL: https://github.com/apache/couchdb-fauxton/pull/535
Reviewed-By: Benjamin Keen <be...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/685d6f82
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/685d6f82
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/685d6f82

Branch: refs/heads/master
Commit: 685d6f82d60f7d020c64bdf5010dc1f84d77bf5e
Parents: d1d9832
Author: Robert Kowalski <ro...@apache.org>
Authored: Thu Sep 24 13:14:32 2015 +0200
Committer: Robert Kowalski <ro...@apache.org>
Committed: Thu Oct 1 14:59:11 2015 +0200

----------------------------------------------------------------------
 app/addons/fauxton/components.react.jsx           | 18 +++++++++++++-----
 .../fauxton/navigation/components.react.jsx       |  5 ++---
 2 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/685d6f82/app/addons/fauxton/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.react.jsx b/app/addons/fauxton/components.react.jsx
index f1bff68..d877ce1 100644
--- a/app/addons/fauxton/components.react.jsx
+++ b/app/addons/fauxton/components.react.jsx
@@ -65,8 +65,14 @@ function (app, FauxtonAPI, React, ZeroClipboard) {
       ZeroClipboard.config({ moviePath: getZeroClipboardSwfPath() });
     },
 
-    componentDidUpdate: function () {
-      this.clipboard = new ZeroClipboard(document.getElementById("copy-text-" + this.props.uniqueKey));
+    componentDidMount: function () {
+      var el = this.refs["copy-text-" + this.props.uniqueKey].getDOMNode();
+      this.clipboard = new ZeroClipboard(el);
+      this.clipboard.on('load', function () {
+        this.clipboard.on('mouseup', function () {
+          this.props.onClipBoardClick();
+        }.bind(this));
+      }.bind(this));
     },
 
     render: function () {
@@ -79,10 +85,12 @@ function (app, FauxtonAPI, React, ZeroClipboard) {
             value={this.props.textToCopy} />
           <a 
             id={"copy-text-" + this.props.uniqueKey}
-            className="fonticon-clipboard icon btn copy-button" 
+            className="fonticon-clipboard icon btn copy-button"
             data-clipboard-text={this.props.textToCopy} 
-            data-bypass="true" 
-            title="Copy to clipboard" >
+            data-bypass="true"
+            ref={"copy-text-" + this.props.uniqueKey}
+            title="Copy to clipboard"
+          >
             Copy
           </a>
         </p>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/685d6f82/app/addons/fauxton/navigation/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/navigation/components.react.jsx b/app/addons/fauxton/navigation/components.react.jsx
index 9732893..b3b80c6 100644
--- a/app/addons/fauxton/navigation/components.react.jsx
+++ b/app/addons/fauxton/navigation/components.react.jsx
@@ -14,11 +14,10 @@ define([
   'api',
   'react',
   'addons/fauxton/navigation/stores',
-  'addons/fauxton/navigation/actions',
-  'addons/fauxton/dependencies/ZeroClipboard'
+  'addons/fauxton/navigation/actions'
 ],
 
-function (app, FauxtonAPI, React, Stores, Actions, ZeroClipboard) {
+function (app, FauxtonAPI, React, Stores, Actions) {
   var navBarStore = Stores.navBarStore;
 
   var Footer = React.createClass({