Clear the code-block when switching categories
This commit is contained in:
		
							parent
							
								
									0705a8526d
								
							
						
					
					
						commit
						3f47e98a75
					
				
					 1 changed files with 10 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue