Merge pull request #32 from DEVTomatoCake/jank/empty-typebox-md

Fix error for empty typebox
This commit is contained in:
MathMan05
2024-07-24 12:55:09 -05:00
committed by GitHub

View File

@@ -470,30 +470,28 @@ class MarkDown{
restore();
}
static gatherBoxText(element:HTMLElement){
const children=element.childNodes;
if(element.tagName.toLowerCase()==="img"){
return (element as HTMLImageElement).alt;
}
if(element.tagName.toLowerCase()==="br"){
return "\n";
}
if(children.length!==0){
let build="";
for(const thing of children){
if(thing instanceof Text){
let build="";
for(const thing of element.childNodes){
const text=thing.textContent;
build+=text;
continue;
}
const text=this.gatherBoxText(thing as HTMLElement);
if(text){
build+=text;
}
if(thing instanceof Text){
const text=thing.textContent;
build+=text;
continue;
}
const text=this.gatherBoxText(thing as HTMLElement);
if(text){
build+=text;
}
return build;
}
return build;
}
}