Commit 33188eb0 authored by Romain Casati's avatar Romain Casati
Browse files

Support of new notebook opening via menubar.

parent 573e5416
Pipeline #345986 passed with stages
in 5 minutes and 24 seconds
...@@ -4,13 +4,18 @@ ...@@ -4,13 +4,18 @@
* Callback for Basthon loading. * Callback for Basthon loading.
*/ */
function onLoad() { function onLoad() {
/* loading content from query string or from local storage */
const notebook = Jupyter.notebook; const notebook = Jupyter.notebook;
// avoiding notebook loading failure. // avoiding notebook loading failure.
if( !notebook ) { if( !notebook ) {
location.reload(); location.reload();
} }
if( !notebook.loadFromQS() ) { /*
loading content from query string or from local storage.
if global variale basthonEmptyNotebook is set to true,
we open a new notebook
(see kernelselector.js).
*/
if( !window.basthonEmptyNotebook && !notebook.loadFromQS() ) {
notebook.loadFromStorage(); notebook.loadFromStorage();
} }
......
...@@ -303,6 +303,15 @@ define([ ...@@ -303,6 +303,15 @@ define([
KernelSelector.prototype.new_notebook = function (kernel_name) { KernelSelector.prototype.new_notebook = function (kernel_name) {
/*
opening new notebook and setting basthonEmptyNotebook
global variale to true to force empty notebook
(see Basthons's gui.js).
*/
var w = window.open(window.location.href);
w.basthonEmptyNotebook = true;
return w;
var w = window.open('', IPython._target); var w = window.open('', IPython._target);
// Create a new notebook in the same path as the current // Create a new notebook in the same path as the current
// notebook's path. // notebook's path.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment