Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #31 from ckeditor/t/30
Browse files Browse the repository at this point in the history
Other: Optional notification title when upload fails. Closes #30.
  • Loading branch information
Piotr Jasiun committed Jun 5, 2017
2 parents 66978f5 + f0e3a8c commit 1a6306c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lang/contexts.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"Insert image": "Label for the insert image toolbar button."
"Insert image": "Label for the insert image toolbar button.",
"Upload failed": "Title of the notification displayed when upload fails."
}
6 changes: 5 additions & 1 deletion src/imageuploadengine.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export default class ImageUploadEngine extends Plugin {
*/
load( loader, batch, imageElement ) {
const editor = this.editor;
const t = editor.locale.t;
const doc = editor.document;
const fileRepository = editor.plugins.get( FileRepository );
const notification = editor.plugins.get( Notification );
Expand Down Expand Up @@ -127,7 +128,10 @@ export default class ImageUploadEngine extends Plugin {
.catch( msg => {
// Might be 'aborted'.
if ( loader.status == 'error' ) {
notification.showWarning( msg, { namespace: 'upload' } );
notification.showWarning( msg, {
title: t( 'Upload failed' ),
namespace: 'upload'
} );
}

clean();
Expand Down
1 change: 1 addition & 0 deletions tests/imageuploadengine.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ describe( 'ImageUploadEngine', () => {

notification.on( 'show:warning', ( evt, data ) => {
expect( data.message ).to.equal( 'Reading error.' );
expect( data.title ).to.equal( 'Upload failed' );
evt.stop();

done();
Expand Down

0 comments on commit 1a6306c

Please sign in to comment.