mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-06 11:35:24 +08:00
Merge pull request #1334 from fawce/keycuts
Make Control-S (or Cmd-S on Apple) save the actual notebook instead of bringing up the useless 'save as html' dialog. This doesn't disable the C-m-s keybinding, simply adds the far more familiar and common C-s.
This commit is contained in:
commit
5067e77292
@ -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,14 @@ 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();
|
||||
return false;
|
||||
} 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…
Reference in New Issue
Block a user