Skip to content

Commit 9b18d07

Browse files
committed
Switch sessions instead of opening in new window
1 parent ee79a7f commit 9b18d07

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

notebook/static/notebook/js/notebook.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2854,7 +2854,7 @@ define([
28542854
}
28552855
var that = this;
28562856
var current_dir = $('body').attr('data-notebook-path').split('/').slice(0, -1).join("/");
2857-
current_dir = current_dir? currend_dir + "/": "";
2857+
current_dir = current_dir? current_dir + "/": "";
28582858
var dialog_body = $('<div/>').append(
28592859
$('<p/>').addClass('save-message')
28602860
.text(i18n.msg._('Enter a notebook path relative to notebook dir'))
@@ -2896,7 +2896,12 @@ define([
28962896
};
28972897
return that.contents.save(nb_path, model)
28982898
.then(function(data) {
2899-
window.open(data.path, '_blank');
2899+
d.modal('hide');
2900+
that.notebook_name = data.name;
2901+
that.notebook_path = data.path;
2902+
that.session.rename_notebook(data.path);
2903+
that.events.trigger('notebook_renamed.Notebook', data);
2904+
29002905
},function(error) {
29012906
console.error(i18n.msg._(error.message || 'Unknown error saving notebook'));
29022907
});
@@ -2924,6 +2929,12 @@ define([
29242929
},
29252930
},
29262931
open : function () {
2932+
d.find('input[type="text"]').keydown(function (event) {
2933+
if (event.which === keyboard.keycodes.enter) {
2934+
d.find('.btn-primary').first().click();
2935+
return false;
2936+
}
2937+
});
29272938
d.find('input[type="text"]').focus().select();
29282939
}
29292940
});

0 commit comments

Comments
 (0)