Skip to content
Permalink
Browse files

Merge branch 't/13794' into major

  • Loading branch information...
Tade0 committed May 23, 2016
2 parents 45f3e0e + bd0e45b commit 59944a6499aa7debf253e5e0edc8361ce95b2ac9
Showing with 40 additions and 2 deletions.
  1. +1 −0 CHANGES.md
  2. +7 −2 plugins/uploadimage/plugin.js
  3. +32 −0 tests/plugins/uploadimage/uploadimage.js
@@ -5,6 +5,7 @@ CKEditor 4 Changelog

New Features:

* [#13794](http://dev.ckeditor.com/ticket/13794): [Upload Image](http://ckeditor.com/addon/uploadimage) Use `uploaded.width/height` if set.
* [#13829](http://dev.ckeditor.com/ticket/13829): Fixed: No class in [Widget](http://ckeditor.com/addon/widget) wrapper that would identify the widget type.
* [#14449](http://dev.ckeditor.com/ticket/14449): Introduced the [Balloon Panel](http://ckeditor.com/addon/balloonpanel) plugin.
* [#12077](https://dev.ckeditor.com/ticket/12077): Added support for the HTML5 `download` attribute in link (`<a>`) elements. Thanks to [sbusse](https://github.com/sbusse)!
@@ -53,10 +53,15 @@
},

onUploaded: function( upload ) {
// Width and height could be returned by server (#13519).
var $img = this.parts.img.$,
width = upload.responseData.width || $img.naturalWidth,
height = upload.responseData.height || $img.naturalHeight;

// Set width and height to prevent blinking.
this.replaceWith( '<img src="' + upload.url + '" ' +
'width="' + this.parts.img.$.naturalWidth + '" ' +
'height="' + this.parts.img.$.naturalHeight + '">' );
'width="' + width + '" ' +
'height="' + height + '">' );
}
} );

@@ -55,13 +55,17 @@
CKEDITOR.fileTools.fileLoader.prototype.loadAndUpload = function( url ) {
loadAndUploadCount++;
lastUploadUrl = url;

this.responseData = {};
};

CKEDITOR.fileTools.fileLoader.prototype.load = function() {};

CKEDITOR.fileTools.fileLoader.prototype.upload = function( url ) {
uploadCount++;
lastUploadUrl = url;

this.responseData = {};
};
},

@@ -207,6 +211,34 @@
} );
},

'test setting image dimensions via response (integration test) (#13794)': function() {
var bot = this.editorBots.classic,
editor = this.editors.classic;

bot.setData( '', function() {
pasteFiles( editor, [ bender.tools.getTestPngFile() ] );

var loader = editor.uploadRepository.loaders[ 0 ];

loader.data = bender.tools.pngBase64;
loader.uploadTotal = 10;
loader.changeStatus( 'uploading' );

loader.responseData.width = 555;
loader.responseData.height = 444;

resumeAfter( loader, 'uploaded', function() {
assert.sameData( '<p><img src="' + IMG_URL + '" style="height:444px; width:555px" /></p>', editor.getData() );
assert.areSame( 0, editor.editable().find( 'img[data-widget="image"]' ).count() );
} );

loader.url = IMG_URL;
loader.changeStatus( 'uploaded' );

wait();
} );
},

'test supportedTypes png': function() {
var bot = this.editorBots.classic,
editor = this.editors.classic;

0 comments on commit 59944a6

Please sign in to comment.
You can’t perform that action at this time.