We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents cbf7db7 + 4455bcf commit b1e5f72Copy full SHA for b1e5f72
1 file changed
notebook/static/notebook/js/clipboard.js
@@ -34,10 +34,18 @@ function load_json(clipboard) {
34
return JSON.parse(s.slice(pix + jcbprefix.length, six));
35
}
36
37
+function isProgrammaticCopy(event) {
38
+ return (typeof(event.target.selectionStart) !== 'undefined'
39
+ && typeof(event.target.selectionEnd) !== 'undefined'
40
+ && ((event.target.selectionEnd - event.target.selectionStart) > 0));
41
+}
42
+
43
function copy(event) {
44
if ((Jupyter.notebook.mode !== 'command') ||
45
// window.getSelection checks if text is selected, e.g. in output
- !window.getSelection().isCollapsed) {
46
+ !window.getSelection().isCollapsed ||
47
+ // Allow programmatic copy
48
+ isProgrammaticCopy(event)) {
49
return;
50
51
var selecn = Jupyter.notebook.get_selected_cells().map(
0 commit comments