From 4dc94e29c82a89bd83d75ef898b04e2f97314e3a Mon Sep 17 00:00:00 2001 From: Brian Granger Date: Thu, 31 May 2012 15:04:35 -0700 Subject: [PATCH 1/3] ENTER submits the rename notebook dialog. --- IPython/frontend/html/notebook/static/js/savewidget.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/IPython/frontend/html/notebook/static/js/savewidget.js b/IPython/frontend/html/notebook/static/js/savewidget.js index 2ffaf315b..5b33e8ecd 100644 --- a/IPython/frontend/html/notebook/static/js/savewidget.js +++ b/IPython/frontend/html/notebook/static/js/savewidget.js @@ -94,6 +94,15 @@ var IPython = (function (IPython) { "Cancel": function () { $(this).dialog('close'); } + }, + open : function (event, ui) { + var that = $(this); + // Upon ENTER, click the OK button. + that.keydown(function (event, ui) { + if (event.which === 13) { + that.parent().find('button').first().click(); + } + }); } }); } From 010c35b13015cb2e45007b3ebf0daa2f53f48473 Mon Sep 17 00:00:00 2001 From: Brian Granger Date: Thu, 31 May 2012 21:54:59 -0700 Subject: [PATCH 2/3] Making the input text area watch for `ENTER` in nb renames. --- IPython/frontend/html/notebook/static/js/savewidget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IPython/frontend/html/notebook/static/js/savewidget.js b/IPython/frontend/html/notebook/static/js/savewidget.js index 5b33e8ecd..0f59504d6 100644 --- a/IPython/frontend/html/notebook/static/js/savewidget.js +++ b/IPython/frontend/html/notebook/static/js/savewidget.js @@ -98,7 +98,7 @@ var IPython = (function (IPython) { open : function (event, ui) { var that = $(this); // Upon ENTER, click the OK button. - that.keydown(function (event, ui) { + that.find('input[type="text"]').keydown(function (event, ui) { if (event.which === 13) { that.parent().find('button').first().click(); } From fc096c723261b0f25ab8eee7d053c8a9ae3c9258 Mon Sep 17 00:00:00 2001 From: Brian Granger Date: Thu, 31 May 2012 21:57:42 -0700 Subject: [PATCH 3/3] Using IPython.utils.keycodes in the nb rename dialog. --- IPython/frontend/html/notebook/static/js/savewidget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IPython/frontend/html/notebook/static/js/savewidget.js b/IPython/frontend/html/notebook/static/js/savewidget.js index 0f59504d6..8471cb361 100644 --- a/IPython/frontend/html/notebook/static/js/savewidget.js +++ b/IPython/frontend/html/notebook/static/js/savewidget.js @@ -99,7 +99,7 @@ var IPython = (function (IPython) { var that = $(this); // Upon ENTER, click the OK button. that.find('input[type="text"]').keydown(function (event, ui) { - if (event.which === 13) { + if (event.which === utils.keycodes.ENTER) { that.parent().find('button').first().click(); } });