diff --git a/plugins/c9.ide.ace/ace.js b/plugins/c9.ide.ace/ace.js
index bf36419e..bfb3f332 100644
--- a/plugins/c9.ide.ace/ace.js
+++ b/plugins/c9.ide.ace/ace.js
@@ -2631,10 +2631,10 @@
});
plugin.on("paste", function(e) {
if (e.native) return; // Ace handles this herself
-
- var data = e.clipboardData.getData("text/plain");
- if (data !== false)
- ace.onPaste(data);
+ e.clipboardData.getData("text/plain", function(err, data) {
+ if (!err && data && data !== false)
+ ace.onPaste(data);
+ });
});
plugin.on("blur", function() {
blur();
diff --git a/plugins/c9.ide.clipboard/clipboard.js b/plugins/c9.ide.clipboard/clipboard.js
index d02da468..ddb6ba74 100644
--- a/plugins/c9.ide.clipboard/clipboard.js
+++ b/plugins/c9.ide.clipboard/clipboard.js
@@ -124,6 +124,15 @@ define(function(require, exports, module) {
getData: function(type, callback) {
var data = provider.get(type);
+ if (callback && data && data.then) {
+ return data.then(function(text) {
+ callback(null, text);
+ }, function(err) {
+ showAlert(null, true);
+ callback(err || new Error("rejected"));
+ });
+ }
+
// If `data` is false the provider was not able to fetch data from the clipboard.
// This is usually because the browser does not allow this for security reasons.
// The browser (chrome) does allow this when the cloud9 plugin is installed.
@@ -255,9 +264,8 @@ define(function(require, exports, module) {
+ "textarea below.
")
- + "To enable the native keyboard either use "
- + "Command-C on Mac or Ctrl-C on Windows or for Chrome install "
- + "the Cloud9 App at the Chrome store.",
+ + "To enable the native keyboard use Command-C on Mac or Ctrl-C on Windows
"
+ + (navigator.clipboard ? " or grant clipboard access to the page" : ""),
function() {
if (alert.dontShow)
settings.set("user/clipboard/@dontshow", true);
diff --git a/plugins/c9.ide.clipboard/html5.js b/plugins/c9.ide.clipboard/html5.js
index 4e306e8c..4b65c71f 100644
--- a/plugins/c9.ide.clipboard/html5.js
+++ b/plugins/c9.ide.clipboard/html5.js
@@ -84,6 +84,9 @@ define(function(require, exports, module) {
if (!full && nativeObject)
return handleClipboardData(nativeObject, type);
+ if (navigator.clipboard && navigator.clipboard.readText)
+ return navigator.clipboard.readText();
+
var data;
var getData = function(e) {
data = full
diff --git a/plugins/c9.ide.terminal/terminal.js b/plugins/c9.ide.terminal/terminal.js
index eb51a240..6544af1a 100644
--- a/plugins/c9.ide.terminal/terminal.js
+++ b/plugins/c9.ide.terminal/terminal.js
@@ -1167,9 +1167,10 @@ define(function(require, exports, module) {
plugin.on("paste", function(e) {
if (e.native) return; // Ace handles this herself
- var data = e.clipboardData.getData("text/plain");
- if (data !== false)
- aceterm.onPaste(data);
+ e.clipboardData.getData("text/plain", function(err, data) {
+ if (!err && data && data !== false)
+ aceterm.onPaste(data);
+ });
});
plugin.on("focus", function(e) {