Variation de l'opacité pour indiquer l'état d'avancement.
[ckeditor.git] / skins / ckeditor / plugins / plinn_image / plugin.js
index 13ce7f7..631f9fa 100644 (file)
@@ -46,10 +46,12 @@ PlinnCKDDUploader.prototype.createFileProxy = function(file) {
        var container = new CKEDITOR.dom.element('span');
        var rel = CKEDITOR.dom.element.createFromHtml('<span style="position:relative"/>');
        container.append(rel);
-       var progressBar = CKEDITOR.dom.element.createFromHtml('<span style="display:block; position:absolute; background:#ef8e32; height:4px; border-radius:2px; width:0"/>')
+       var progressBar = CKEDITOR.dom.element.createFromHtml(
+               '<span style="display:block; position:absolute; background:#ef8e32; height:4px; border-radius:2px; width:0; left:0; top:1em"/>');
        rel.append(progressBar);
        var link = new CKEDITOR.dom.element('a');
        link.setAttribute('href', '#');
+       link.setStyle('opacity', 0.2);
        link.appendText(file.name);
        container.append(link);
 
@@ -72,6 +74,7 @@ PlinnCKDDUploader.prototype.handleFiles = function(files) {
                else {
                        proxy = this.createFileProxy(file);
                        this.editor.insertElement(proxy.container);
+                       this.editor.insertText(' ');
                        this.uploadQueuePush(proxy);
                }
        }
@@ -136,6 +139,8 @@ PlinnCKDDUploader.prototype.progressHandlerCB = function(progress) {
        var size = this.progressBarMaxSize * progress;
        size = Math.round(size);
        this.progressBar.setStyle('width', String(size) + 'px');
+       var currentOpacity = this.uploadedItem.link.getStyle('opacity');
+       this.uploadedItem.link.setStyle('opacity', Math.max(currentOpacity, progress));
 };
 
 PlinnCKDDUploader.prototype.progressHandler = function(evt) {