diff --git a/html_resources/selector.js b/html_resources/selector.js index e6b4e89..b963257 100644 --- a/html_resources/selector.js +++ b/html_resources/selector.js @@ -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);