Clear the code-block when switching categories

This commit is contained in:
MrOtherGuy 2020-09-04 09:47:44 +03:00
parent 0705a8526d
commit 3f47e98a75

View file

@ -104,8 +104,18 @@ function getSecondaryCategories(list){
return ret
}
function clearCodeBlock(){
const pre = document.getElementById("previewBox");
for(let el of Array.from(pre.childNodes)){
pre.remove(el)
}
return
}
async function onCategoryClicked(categoryNode,isSecondary = false){
clearCodeBlock();
currentCategory.set(categoryNode,isSecondary);
// Using textContent is bad but meh
//let names = DB.query(categoryNode.textContent);