From 352677b8b85f1dbe17d2c09eaa819d709f4a3e8d Mon Sep 17 00:00:00 2001 From: MrOtherGuy Date: Sat, 7 May 2022 19:31:59 +0300 Subject: [PATCH] Return little less early when initializing code-block content. --- html_resources/code-block/code-block.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/html_resources/code-block/code-block.js b/html_resources/code-block/code-block.js index 3cf0f74..2c0e4f0 100644 --- a/html_resources/code-block/code-block.js +++ b/html_resources/code-block/code-block.js @@ -21,16 +21,15 @@ class CodeBlock extends HTMLElement{ } determineAndLoadContent(){ - const src = this.src; - if(!src){ - return - } - CodeBlock.getSource(src) + CodeBlock.getSource(this.src) .then( (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(){