Skip to content

Commit 31799f6

Browse files
committed
update deleting of cells
1 parent 4b09553 commit 31799f6

File tree

1 file changed

+21
-2
lines changed
  • dnotebook/src/public/javascripts

1 file changed

+21
-2
lines changed

dnotebook/src/public/javascripts/index.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,27 @@ $(document).on("click", "button.run", function () {
321321
})
322322

323323
$(document).on("click", "button.del", function () {
324-
let id = this.id.split("_")[1]
325-
console.log(id, this.id, __code_cell_count)
324+
let id_split = this.id.split("_")
325+
let id = id_split[1]
326+
let btn_type = id_split[0].split("-")[1]
327+
328+
if(btn_type =="text"){
329+
330+
let div_scope = `div_text-${id}`
331+
let md_scope = `text-div_${id}`
332+
333+
delete md_texts[md_scope]
334+
delete vars_in_scope[div_scope]
335+
336+
let cell_index = cells_order.indexOf(div_scope)
337+
cells_order.splice(cell_index,1)
338+
}else{
339+
let div_scope = `div-${id}`
340+
delete vars_in_scope[div_scope]
341+
342+
let cell_index = cells_order.indexOf(div_scope)
343+
cells_order.splice(cell_index,1)
344+
}
326345
delete_cell(id)
327346
})
328347

0 commit comments

Comments
 (0)