Skip to content

Commit 5c2d9b8

Browse files
committed
save cells_order whent notebook is uploaded
1 parent 14c206c commit 5c2d9b8

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

notebookjs/src/public/javascripts/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ function exec_cell(c_id) {
7777
}
7878
}
7979

80+
// $(`#out_${id}`).empty()
8081
$(`#out_${id}`).html(output);
8182
// document.getElementById("cell_spinner-1").style.display = "none"
8283
// document.getElementById("cell_num-1").style.display = "block"

notebookjs/src/public/javascripts/utils.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ function this_div() {
8989

9090
function viz(name, callback) {
9191
// out_div-1
92-
let id = `#out_div${window.current_cell}`
92+
93+
let id = `#out_${window.current_cell}`
9394
$(`${id}`).append(`<div id=${name}></div>`)
9495

9596
let cb = callback(name);
@@ -270,10 +271,11 @@ function html_load(new_id) {
270271

271272
function load_notebook(json) {
272273

273-
274+
cells_order = []
274275
for (let key in json) {
275276

276277
let id = key.split("-")[1]
278+
277279

278280
if (Object.prototype.hasOwnProperty.call(json[key], "in")) {
279281
let html = html_load(id)
@@ -291,6 +293,7 @@ function load_notebook(json) {
291293
editor.getDoc().setValue(input);
292294

293295
vars_in_scope[`div-${id}`] = editor
296+
cells_order.push(`div-${id}`)
294297

295298
let out = json[key]["out"]
296299

@@ -327,6 +330,7 @@ function load_notebook(json) {
327330
md_texts[`text-div_${Number(id)}`] = md_out;
328331

329332
vars_in_scope[`div_text-${id}`] = ""
333+
cells_order.push(`div_text-${id}`)
330334

331335
$(`textarea#text-box_${id}`).addClass("text-box")
332336
$(`textarea#text-box_${id}`).val(md_out)

0 commit comments

Comments
 (0)