Skip to content
Permalink
Browse files

Merge branch 't/13486'

  • Loading branch information...
pjasiun committed Jul 2, 2015
2 parents 89a3e16 + e64912d commit 5b1c6c41914acb9d926c05dcd751109c98974673
@@ -3,6 +3,10 @@ CKEditor 4 Changelog

## CKEditor 4.5.1

Fixed Issues:

* [#13486](http://dev.ckeditor.com/ticket/13486): Fixed: Upload image should log an error, not throw an error when upload URL is not set.

## CKEditor 4.5

New Features:
@@ -718,7 +718,7 @@
*
* @param {Object} config The configuration file.
* @param {String} [type] Upload file type.
* @returns {String} Upload URL.
* @returns {String/null} Upload URL or `null` if none of the config options was defined.
*/
getUploadUrl: function( config, type ) {
var capitalize = CKEDITOR.tools.capitalize;
@@ -733,7 +733,7 @@
return config.filebrowserUploadUrl + '&responseType=json';
}

throw 'Upload URL is not defined.';
return null;
},

/**
@@ -26,6 +26,14 @@
var fileTools = CKEDITOR.fileTools,
uploadUrl = fileTools.getUploadUrl( editor.config, 'image' );

if ( !uploadUrl ) {
window.console && window.console.log(
'Error: Upload URL for the Upload Image feature was not defined. ' +
'For more information visit: http://docs.ckeditor.com/#!/guide/dev_file_upload'
);
return;
}

// Handle images which are available in the dataTransfer.
fileTools.addUploadWidget( editor, 'uploadimage', {
supportedTypes: /image\/(jpeg|png|gif)/,
@@ -94,12 +94,9 @@
},

'test getUploadUrl - throw error if no matching config': function() {
try {
getUploadUrl( {} );
assert.fail( 'getUploadUrl should throw error if no matching configuration option was found.' );
} catch ( err ) {
assert.areSame( 'Upload URL is not defined.', err );
}
var uploadUrl = getUploadUrl( {} );

assert.isNull( uploadUrl, 'null returned when none of upload URLs is defined' );
},

'test isTypeSupported 1': function() {
@@ -0,0 +1,7 @@
<div id="editor">
<p>I'm working!</p>
</div>

<script>
CKEDITOR.replace( 'editor' );
</script>
@@ -0,0 +1,10 @@
@bender-ui: collapsed
@bender-tags: 4.5.1, tc, 13486, filetools
@bender-ckeditor-plugins: uploadimage, wysiwygarea, toolbar, basicstyles

Run this test with the console opened.

Expected:

* Editor should be fully functional except the `uploadimage` plugin.
* No errors on IE8-9, an error logged in the console that `upload URL` was not set on other browsers.

0 comments on commit 5b1c6c4

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