Commit 0c761f3b authored by Romain Casati's avatar Romain Casati
Browse files

Loading from QS is managed by GUI, no more by Notebook.

parent 550cb154
......@@ -27,7 +27,7 @@ window.basthonGUI = (function () {
we open a new notebook
(see kernelselector.js).
*/
if( !window.basthonEmptyNotebook && !that.notebook.loadFromQS() ) {
if( !window.basthonEmptyNotebook && !await that.loadFromQS() ) {
that.notebook.loadFromStorage();
}
......@@ -74,6 +74,24 @@ window.basthonGUI = (function () {
};
};
/**
* Loading the notebook from query string (ipynb=).
*/
that.loadFromQS = async function () {
const url = new URL(window.location.href);
const ipynb_key = 'ipynb';
const file_key = 'file';
var ipynb;
if( url.searchParams.has(ipynb_key) ) {
ipynb = url.searchParams.get(ipynb_key);
ipynb = decodeURIComponent(ipynb);
}
if( ipynb ) {
that.notebook.load(JSON.parse(ipynb));
return ipynb;
}
};
/**
* Copying a string to clipboard.
*/
......
......@@ -3064,19 +3064,6 @@ define([
}
};
/** [Basthon]
* Loading the notebook from query string.
*/
Notebook.prototype.loadFromQS = function (key="ipynb") {
const url = new URL(window.location.href);
if( url.searchParams.has(key) ) {
var ipynb = url.searchParams.get(key);
ipynb = decodeURIComponent(ipynb);
this.load(JSON.parse(ipynb));
return ipynb;
}
};
/**
* Explicitly trust the output of this notebook.
*/
......
Markdown is supported
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