From 31799f61f0d49e59e1fdcb459faaade95ae2711c Mon Sep 17 00:00:00 2001 From: steveoni Date: Mon, 24 Aug 2020 13:41:05 +0100 Subject: [PATCH] update deleting of cells --- dnotebook/src/public/javascripts/index.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/dnotebook/src/public/javascripts/index.js b/dnotebook/src/public/javascripts/index.js index ce67ee5..8653e2e 100644 --- a/dnotebook/src/public/javascripts/index.js +++ b/dnotebook/src/public/javascripts/index.js @@ -321,8 +321,27 @@ $(document).on("click", "button.run", function () { }) $(document).on("click", "button.del", function () { - let id = this.id.split("_")[1] - console.log(id, this.id, __code_cell_count) + let id_split = this.id.split("_") + let id = id_split[1] + let btn_type = id_split[0].split("-")[1] + + if(btn_type =="text"){ + + let div_scope = `div_text-${id}` + let md_scope = `text-div_${id}` + + delete md_texts[md_scope] + delete vars_in_scope[div_scope] + + let cell_index = cells_order.indexOf(div_scope) + cells_order.splice(cell_index,1) + }else{ + let div_scope = `div-${id}` + delete vars_in_scope[div_scope] + + let cell_index = cells_order.indexOf(div_scope) + cells_order.splice(cell_index,1) + } delete_cell(id) })