diff --git a/Models/Editor.js b/Models/Editor.js index 97074c1..b51c8f2 100644 --- a/Models/Editor.js +++ b/Models/Editor.js @@ -104,10 +104,19 @@ jsOMS.Modules.Draw.Editor.prototype.initCanvas = function() { - const img = this.editor.getElementsByTagName('img'); + const img = this.canvas.getAttribute('data-src'), + self = this; - if(img.length > 0) { - this.canvas.getContext("2d").drawImage(img[0], 0, 0); + if(typeof img !== 'undefined' && img.length > 0) { + let imgObj = new Image(); + + imgObj.addEventListener('load', function() { + self.canvas.width = imgObj.width; + self.canvas.height = imgObj.height; + self.canvas.getContext("2d").drawImage(imgObj, 0, 0); + }); + + imgObj.src = img; } }; diff --git a/Theme/Backend/draw-single.tpl.php b/Theme/Backend/draw-single.tpl.php index 77ba1f1..cf65219 100644 --- a/Theme/Backend/draw-single.tpl.php +++ b/Theme/Backend/draw-single.tpl.php @@ -75,8 +75,7 @@ echo $this->getData('nav')->render(); ?>
- - +