added key handler for control-s to notebook, seems to work pretty well

fawce 14 years ago
parent 91745493f1
commit 6120c07c4d

@ -70,7 +70,7 @@ var IPython = (function (IPython) {
if (this.read_only){
return false;
}
// note that we are comparing and setting the time to wait at each key press.
// a better wqy might be to generate a new function on each time change and
// assign it to CodeCell.prototype.request_tooltip_after_time
@ -82,7 +82,8 @@ var IPython = (function (IPython) {
if(event.type === 'keydown' ){
that.remove_and_cancel_tooltip();
}
if (event.keyCode === 13 && (event.shiftKey || event.ctrlKey)) {
// Always ignore shift-enter in CodeMirror as we handle it.
return true;

@ -62,7 +62,13 @@ var IPython = (function (IPython) {
$(document).keydown(function (event) {
// console.log(event);
if (that.read_only) return true;
if (event.which === 27) {
// Save (CTRL+S) or (AppleKey+S)
//metaKey = applekey on mac
if ((event.ctrlKey || event.metaKey) && event.keyCode==83) {
IPython.save_widget.save_notebook();
event.preventDefault();
} else if (event.which === 27) {
// Intercept escape at highest level to avoid closing
// websocket connection with firefox
event.preventDefault();

@ -67,7 +67,7 @@ var IPython = (function (IPython) {
// handlers and is used to provide custom key handling. Its return
// value is used to determine if CodeMirror should ignore the event:
// true = ignore, false = don't ignore.
if (event.keyCode === 13 && (event.shiftKey || event.ctrlKey)) {
// Always ignore shift-enter in CodeMirror as we handle it.
return true;

Loading…
Cancel
Save