Return little less early when initializing code-block content.

This commit is contained in:
MrOtherGuy 2022-05-07 19:31:59 +03:00
parent d038f7c1a1
commit 352677b8b8

View file

@ -21,16 +21,15 @@ class CodeBlock extends HTMLElement{
} }
determineAndLoadContent(){ determineAndLoadContent(){
const src = this.src; CodeBlock.getSource(this.src)
if(!src){
return
}
CodeBlock.getSource(src)
.then( .then(
(data) => this.consumeData(data,CodeBlock.InsertMode.Replace), (data) => this.consumeData(data,CodeBlock.InsertMode.Replace),
(e) => this.consumeData({content:this.textContent},CodeBlock.InsertMode.Replace) (e) => {
if(this.textContent.length){
this.consumeData({content:this.textContent},CodeBlock.InsertMode.Replace);
}
}
); );
} }
get name(){ get name(){