Application des styles comme il faut.
[ckeditor.git] / skins / ckeditor / plugins / plinn_image / plugin.js
index 046b7ad..3e2606c 100644 (file)
@@ -82,18 +82,25 @@ PlinnCKDDUploader.prototype.createImageProxy = function(file) {
        img.setAttribute('height', 290);
        img.setStyle('opacity', 0.2);
        img.setAttribute('src', 'no_image.jpg');
        img.setAttribute('height', 290);
        img.setStyle('opacity', 0.2);
        img.setAttribute('src', 'no_image.jpg');
+       img.placeholder = true;
        var size = this.thumbnailSize;
        var size = this.thumbnailSize;
+       var self = this;
        
        img.on('load', function(e) {
        
        img.on('load', function(e) {
-               var img$ = img.$;
-               if (img$.width > img$.height) { // landscape
-                       img$.height = Math.round(size * img$.height / img$.width);
+               if (e.sender.placeholder) {
+                       e.sender.placeholder = false;
+                       return;
+               };
+               var img$ = e.data.$.target;
+               if (img$.naturalWidth > img$.naturalHeight) { // landscape
+                       img$.height = Math.round(size * img$.naturalHeight / img$.naturalWidth);
                        img$.width = size;
                }
                else {
                        img$.width = size;
                }
                else {
-                       img$.width = Math.round(size * img$.width / img$.height);
+                       img$.width = Math.round(size * img$.naturalWidth / img$.naturalHeight);
                        img$.height = size;
                }
                        img$.height = size;
                }
+               self.progressBarMaxSize = img$.width;
                img$.style.opacity = 0.2;
        });
        
                img$.style.opacity = 0.2;
        });
        
@@ -121,7 +128,8 @@ PlinnCKDDUploader.prototype.handleFiles = function(files) {
                        proxy = this.createLinkProxy(file);
                }
                this.editor.insertElement(proxy.container);
                        proxy = this.createLinkProxy(file);
                }
                this.editor.insertElement(proxy.container);
-               this.editor.insertText(' ');
+               if (files.length > 1 && i < files.length-1) {
+                       this.editor.insertText('\n'); }
                this.uploadQueuePush(proxy);
        }
 };
                this.uploadQueuePush(proxy);
        }
 };
@@ -183,6 +191,8 @@ PlinnCKDDUploader.prototype.uploadCompleteHandlerCB = function(req) {
                        img.setAttribute('width', data.getAttribute('width'));
                        img.setAttribute('height', data.getAttribute('height'));
                        img.replace(item.container);
                        img.setAttribute('width', data.getAttribute('width'));
                        img.setAttribute('height', data.getAttribute('height'));
                        img.replace(item.container);
+                       this.previewsLoaded--;
+                       this.previewQueueLoadNext();
                        break;
        }
 };
                        break;
        }
 };
@@ -271,7 +281,6 @@ PlinnCKDDUploader.prototype.previewUploadedImage = function(proxy) {
        
        reader.onload = function(evt) {
                proxy.img.setAttribute('src', evt.target.result);
        
        reader.onload = function(evt) {
                proxy.img.setAttribute('src', evt.target.result);
-               // proxy.img.src = evt.target.result;
                setTimeout(function(){self.previewQueueLoadNext();}, 500);
        };
        reader.readAsDataURL(proxy.file);
                setTimeout(function(){self.previewQueueLoadNext();}, 500);
        };
        reader.readAsDataURL(proxy.file);