Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Test if notebook is loaded during initialization. #898

Merged
merged 1 commit into from
Feb 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,21 @@ define([
};


/**
* Update all references variables in markdown cells
*
*/
var update_md_cells = function () {
var ncells = IPython.notebook.ncells();
var cells = IPython.notebook.get_cells();
for (var i = 0; i < ncells; i++) {
var cell = cells[i];
if (cell.metadata.hasOwnProperty('variables')) {
render_cell(cell)
}
}
};

var load_ipython_extension = function() {
load_css('./main.css');
events.on("rendered.MarkdownCell", function (event, data) {
Expand All @@ -178,15 +193,15 @@ define([

$('#save_widget').append('<i id="notebook-trusted-indicator" class="fa fa-question notebook-trusted" />');
set_trusted_indicator();
/* show values stored in metadata on reload */

/* Show values stored in metadata on reload */
events.on("kernel_ready.Kernel", function () {
var ncells = IPython.notebook.ncells();
var cells = IPython.notebook.get_cells();
for (var i = 0; i < ncells; i++) {
var cell = cells[i];
if (cell.metadata.hasOwnProperty('variables')) {
render_cell(cell)
}
if (Jupyter.notebook !== undefined && Jupyter.notebook._fully_loaded) {
update_md_cells()
} else {
events.on("notebook_loaded.Notebook", function () {
update_md_cells()
})
}
});
};
Expand Down