@@ -13,7 +13,6 @@ define([
13
13
var NewNotebookWidget = function ( selector , options ) {
14
14
this . selector = selector ;
15
15
this . base_url = options . base_url ;
16
- this . notebook_path = options . notebook_path ;
17
16
this . contents = options . contents ;
18
17
this . events = options . events ;
19
18
this . default_kernel = null ;
@@ -74,12 +73,13 @@ define([
74
73
this . events . trigger ( 'kernelspecs_loaded.KernelSpec' , data . kernelspecs ) ;
75
74
} ;
76
75
77
- NewNotebookWidget . prototype . new_notebook = function ( kernel_name ) {
76
+ NewNotebookWidget . prototype . new_notebook = function ( kernel_name , evt ) {
78
77
/** create and open a new notebook */
79
78
var that = this ;
80
79
kernel_name = kernel_name || this . default_kernel ;
81
80
var w = window . open ( undefined , IPython . _target ) ;
82
- this . contents . new_untitled ( that . notebook_path , { type : "notebook" } ) . then (
81
+ var dir_path = $ ( 'body' ) . attr ( 'data-notebook-path' ) ;
82
+ this . contents . new_untitled ( dir_path , { type : "notebook" } ) . then (
83
83
function ( data ) {
84
84
var url = utils . url_path_join (
85
85
that . base_url , 'notebooks' ,
@@ -107,6 +107,9 @@ define([
107
107
}
108
108
} ) ;
109
109
} ) ;
110
+ if ( evt !== undefined ) {
111
+ evt . preventDefault ( ) ;
112
+ }
110
113
} ;
111
114
112
115
return { 'NewNotebookWidget' : NewNotebookWidget } ;
0 commit comments