Fix error for empty typebox
This commit is contained in:
parent
5e9405207b
commit
1c3674b52d
1 changed files with 12 additions and 14 deletions
|
@ -470,30 +470,28 @@ class MarkDown{
|
||||||
restore();
|
restore();
|
||||||
}
|
}
|
||||||
static gatherBoxText(element:HTMLElement){
|
static gatherBoxText(element:HTMLElement){
|
||||||
const children=element.childNodes;
|
|
||||||
if(element.tagName.toLowerCase()==="img"){
|
if(element.tagName.toLowerCase()==="img"){
|
||||||
return (element as HTMLImageElement).alt;
|
return (element as HTMLImageElement).alt;
|
||||||
}
|
}
|
||||||
if(element.tagName.toLowerCase()==="br"){
|
if(element.tagName.toLowerCase()==="br"){
|
||||||
return "\n";
|
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;
|
if(thing instanceof Text){
|
||||||
build+=text;
|
|
||||||
continue;
|
const text=thing.textContent;
|
||||||
}
|
build+=text;
|
||||||
const text=this.gatherBoxText(thing as HTMLElement);
|
continue;
|
||||||
if(text){
|
}
|
||||||
build+=text;
|
const text=this.gatherBoxText(thing as HTMLElement);
|
||||||
}
|
if(text){
|
||||||
|
build+=text;
|
||||||
}
|
}
|
||||||
return build;
|
|
||||||
}
|
}
|
||||||
|
return build;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue