Fix error for empty typebox
This commit is contained in:
@@ -470,16 +470,15 @@ 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="";
|
let build="";
|
||||||
for(const thing of children){
|
for(const thing of element.childNodes){
|
||||||
|
|
||||||
if(thing instanceof Text){
|
if(thing instanceof Text){
|
||||||
|
|
||||||
@@ -495,7 +494,6 @@ class MarkDown{
|
|||||||
return build;
|
return build;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//solution from https://stackoverflow.com/questions/4576694/saving-and-restoring-caret-position-for-contenteditable-div
|
//solution from https://stackoverflow.com/questions/4576694/saving-and-restoring-caret-position-for-contenteditable-div
|
||||||
function saveCaretPosition(context){
|
function saveCaretPosition(context){
|
||||||
|
Reference in New Issue
Block a user