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

Commit 1a6306c

Browse files
author
Piotr Jasiun
committed
Merge pull request #31 from ckeditor/t/30
Other: Optional notification title when upload fails. Closes #30.
2 parents 66978f5 + f0e3a8c commit 1a6306c

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

lang/contexts.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"Insert image": "Label for the insert image toolbar button."
2+
"Insert image": "Label for the insert image toolbar button.",
3+
"Upload failed": "Title of the notification displayed when upload fails."
34
}

src/imageuploadengine.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export default class ImageUploadEngine extends Plugin {
9393
*/
9494
load( loader, batch, imageElement ) {
9595
const editor = this.editor;
96+
const t = editor.locale.t;
9697
const doc = editor.document;
9798
const fileRepository = editor.plugins.get( FileRepository );
9899
const notification = editor.plugins.get( Notification );
@@ -127,7 +128,10 @@ export default class ImageUploadEngine extends Plugin {
127128
.catch( msg => {
128129
// Might be 'aborted'.
129130
if ( loader.status == 'error' ) {
130-
notification.showWarning( msg, { namespace: 'upload' } );
131+
notification.showWarning( msg, {
132+
title: t( 'Upload failed' ),
133+
namespace: 'upload'
134+
} );
131135
}
132136

133137
clean();

tests/imageuploadengine.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ describe( 'ImageUploadEngine', () => {
150150

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

155156
done();

0 commit comments

Comments
 (0)