Changed Roo/HtmlEditorCore.js
authorAlan <alan@roojs.com>
Thu, 19 Jan 2023 07:59:10 +0000 (15:59 +0800)
committerAlan <alan@roojs.com>
Thu, 19 Jan 2023 07:59:10 +0000 (15:59 +0800)
Roo/HtmlEditorCore.js

index 38852b3..e459943 100644 (file)
@@ -608,7 +608,22 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
                 (window.webkitURL && webkitURL);
     
             var url = urlAPI.createObjectURL( cd.files[0]);
-            this.insertAtCursor('<img src=" + url + ">');
+            this.insertAtCursor('<img src="' + url + '">');
+            // is insert asycn?
+            if (this.enableBlocks) {
+                
+                Array.from(d.getElementsByTagName('img')).forEach(function(img) {
+                    if (img.closest('figure')) { // assume!! that it's aready
+                        return;
+                    }
+                    var fig  = new Roo.htmleditor.BlockFigure({
+                        image_src  : img.src
+                    });
+                    fig.updateElement(img); // replace it..
+                    
+                });
+            }
+            
             return false;
         }
         if (cd.types.indexOf('text/html') < 0 ) {