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 #220 from ckeditor/t/ckeditor5/1066
Browse files Browse the repository at this point in the history
Fix: Complete upload icon should not be rendered in Edge. Closes ckeditor/ckeditor5/issues/1066.
  • Loading branch information
oskarwrobel authored Jul 9, 2018
2 parents 30ea1c6 + 61e0e9c commit 9a62cf1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/imageupload/imageuploadprogress.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import uploadingPlaceholder from '../../theme/icons/image_placeholder.svg';
import UIElement from '@ckeditor/ckeditor5-engine/src/view/uielement';
import ViewPosition from '@ckeditor/ckeditor5-engine/src/view/position';
import ViewRange from '@ckeditor/ckeditor5-engine/src/view/range';
import env from '@ckeditor/ckeditor5-utils/src/env';

import '../../theme/imageuploadprogress.css';
import '../../theme/imageuploadicon.css';
Expand Down Expand Up @@ -104,7 +105,8 @@ export default class ImageUploadProgress extends Plugin {
return;
}

if ( status == 'complete' && fileRepository.loaders.get( uploadId ) ) {
// Because in Edge there is no way to show fancy animation of completeIcon we need to skip it.
if ( status == 'complete' && fileRepository.loaders.get( uploadId ) && !env.isEdge ) {
_showCompleteIcon( viewFigure, viewWriter, editor.editing.view );
}

Expand Down
24 changes: 24 additions & 0 deletions tests/imageupload/imageuploadprogress.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-util
import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
import svgPlaceholder from '../../theme/icons/image_placeholder.svg';
import env from '@ckeditor/ckeditor5-utils/src/env';

describe( 'ImageUploadProgress', () => {
const imagePlaceholder = encodeURIComponent( svgPlaceholder );
Expand Down Expand Up @@ -263,4 +264,27 @@ describe( 'ImageUploadProgress', () => {
'</figure>]'
);
} );

it( 'should not create completeIcon element when browser is Microsoft Edge', done => {
testUtils.sinon.stub( env, 'isEdge' ).get( () => true );

setModelData( model, '<paragraph>[]foo</paragraph>' );
editor.execute( 'imageUpload', { file: createNativeFileMock() } );

model.document.once( 'change', () => {
model.document.once( 'change', () => {
expect( getViewData( view ) ).to.equal(
'[<figure class="ck-widget image">' +
'<img src="image.png"></img>' +
'</figure>]<p>foo</p>'
);

done();
}, { priority: 'lowest' } );

adapterMock.mockSuccess( { default: 'image.png' } );
} );

nativeReaderMock.mockSuccess( base64Sample );
} );
} );

0 comments on commit 9a62cf1

Please sign in to comment.