##// END OF EJS Templates
added key handler for control-s to notebook, seems to work pretty well
fawce -
Show More
@@ -70,7 +70,7 b' var IPython = (function (IPython) {'
70 if (this.read_only){
70 if (this.read_only){
71 return false;
71 return false;
72 }
72 }
73
73
74 // note that we are comparing and setting the time to wait at each key press.
74 // note that we are comparing and setting the time to wait at each key press.
75 // a better wqy might be to generate a new function on each time change and
75 // a better wqy might be to generate a new function on each time change and
76 // assign it to CodeCell.prototype.request_tooltip_after_time
76 // assign it to CodeCell.prototype.request_tooltip_after_time
@@ -82,7 +82,8 b' var IPython = (function (IPython) {'
82 if(event.type === 'keydown' ){
82 if(event.type === 'keydown' ){
83 that.remove_and_cancel_tooltip();
83 that.remove_and_cancel_tooltip();
84 }
84 }
85
85
86
86 if (event.keyCode === 13 && (event.shiftKey || event.ctrlKey)) {
87 if (event.keyCode === 13 && (event.shiftKey || event.ctrlKey)) {
87 // Always ignore shift-enter in CodeMirror as we handle it.
88 // Always ignore shift-enter in CodeMirror as we handle it.
88 return true;
89 return true;
@@ -62,7 +62,13 b' var IPython = (function (IPython) {'
62 $(document).keydown(function (event) {
62 $(document).keydown(function (event) {
63 // console.log(event);
63 // console.log(event);
64 if (that.read_only) return true;
64 if (that.read_only) return true;
65 if (event.which === 27) {
65
66 // Save (CTRL+S) or (AppleKey+S)
67 //metaKey = applekey on mac
68 if ((event.ctrlKey || event.metaKey) && event.keyCode==83) {
69 IPython.save_widget.save_notebook();
70 event.preventDefault();
71 } else if (event.which === 27) {
66 // Intercept escape at highest level to avoid closing
72 // Intercept escape at highest level to avoid closing
67 // websocket connection with firefox
73 // websocket connection with firefox
68 event.preventDefault();
74 event.preventDefault();
@@ -67,7 +67,7 b' var IPython = (function (IPython) {'
67 // handlers and is used to provide custom key handling. Its return
67 // handlers and is used to provide custom key handling. Its return
68 // value is used to determine if CodeMirror should ignore the event:
68 // value is used to determine if CodeMirror should ignore the event:
69 // true = ignore, false = don't ignore.
69 // true = ignore, false = don't ignore.
70
70
71 if (event.keyCode === 13 && (event.shiftKey || event.ctrlKey)) {
71 if (event.keyCode === 13 && (event.shiftKey || event.ctrlKey)) {
72 // Always ignore shift-enter in CodeMirror as we handle it.
72 // Always ignore shift-enter in CodeMirror as we handle it.
73 return true;
73 return true;
General Comments 0
You need to be logged in to leave comments. Login now