Skip to content

Commit

Permalink
Merge pull request #921 from sdsawtelle/chrome-clipboard_issue#918
Browse files Browse the repository at this point in the history
Update API for chrome-clipboard PUT request per #918.
  • Loading branch information
jcb91 authored Mar 22, 2017
2 parents a961f47 + c01ec49 commit 9a6a389
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
define([
'base/js/namespace',
'jquery',
'base/js/utils',
'base/js/events'
], function(IPython, $, events) {
], function(IPython, $, utils, events) {
"use strict";
if (window.chrome === undefined) return;

Expand Down Expand Up @@ -42,17 +43,19 @@ define([
data: JSON.stringify(data),
headers: {'Content-Type': 'text/plain'},
async: false,
success: function (data, status, xhr) {
error : function() {console.log('Data transfer for copy-paste has failed.');
}
};
utils.promising_ajax(url, settings).then(
function on_success (data, status, xhr) {
var new_cell = IPython.notebook.insert_cell_below('markdown');
var str = '<img src="' + name + '"/>';
new_cell.set_text(str);
new_cell.execute();
},
error: function () {
console.log('Failed to send to server:', name);
}
};
$.ajax(url, settings);
function on_error (reason) {
console.log('Data transfer for copy-paste has failed.');
});
};

/**
Expand Down Expand Up @@ -152,4 +155,4 @@ define([
load_ipython_extension : load_ipython_extension
};
return extension;
});
});

0 comments on commit 9a6a389

Please sign in to comment.