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 #64 from ckeditor/t/63
Browse files Browse the repository at this point in the history
Other: Placeholder image looks better on wider editors. Closes #63.
  • Loading branch information
Piotr Jasiun authored Oct 2, 2017
2 parents 6be7f4f + 070106a commit edb5e81
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/imageuploadprogress.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default class ImageUploadProgress extends Plugin {

// Show placeholder with infinite progress bar on the top while image is read from disk.
if ( status == 'reading' ) {
viewFigure.addClass( 'ck-appear', 'ck-infinite-progress' );
viewFigure.addClass( 'ck-appear', 'ck-infinite-progress', 'ck-image-upload-placeholder' );
const viewImg = viewFigure.getChild( 0 );
viewImg.setAttribute( 'src', placeholder );

Expand All @@ -87,7 +87,7 @@ export default class ImageUploadProgress extends Plugin {
if ( loader ) {
const progressBar = createProgressBar();

viewFigure.removeClass( 'ck-infinite-progress' );
viewFigure.removeClass( 'ck-infinite-progress', 'ck-image-upload-placeholder' );
viewFigure.appendChildren( progressBar );

// Update progress bar width when uploadedPercent is changed.
Expand All @@ -109,7 +109,7 @@ export default class ImageUploadProgress extends Plugin {
viewFigure.removeClass( 'ck-infinite-progress' );
}

viewFigure.removeClass( 'ck-appear' );
viewFigure.removeClass( 'ck-appear', 'ck-image-upload-placeholder' );
}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/imageuploadprogress.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe( 'ImageUploadProgress', () => {
editor.execute( 'imageUpload', { file: createNativeFileMock() } );

expect( getViewData( viewDocument ) ).to.equal(
'[<figure class="image ck-widget ck-appear ck-infinite-progress" contenteditable="false">' +
'[<figure class="image ck-widget ck-appear ck-infinite-progress ck-image-upload-placeholder" contenteditable="false">' +
`<img src="data:image/svg+xml;utf8,${ imagePlaceholder }"></img>` +
'</figure>]<p>foo</p>'
);
Expand Down Expand Up @@ -150,7 +150,7 @@ describe( 'ImageUploadProgress', () => {
editor.execute( 'imageUpload', { file: createNativeFileMock() } );

expect( getViewData( viewDocument ) ).to.equal(
'[<figure class="image ck-widget ck-appear ck-infinite-progress" contenteditable="false">' +
'[<figure class="image ck-widget ck-appear ck-infinite-progress ck-image-upload-placeholder" contenteditable="false">' +
`<img src="${ base64Sample }"></img>` +
'</figure>]<p>foo</p>'
);
Expand Down Expand Up @@ -179,7 +179,7 @@ describe( 'ImageUploadProgress', () => {
} );

expect( getViewData( viewDocument ) ).to.equal(
'[<figure class="image ck-widget ck-appear ck-infinite-progress" contenteditable="false">' +
'[<figure class="image ck-widget ck-appear ck-infinite-progress ck-image-upload-placeholder" contenteditable="false">' +
`<img src="data:image/svg+xml;utf8,${ imagePlaceholder }"></img>` +
'</figure>]'
);
Expand Down
2 changes: 1 addition & 1 deletion theme/icons/image_placeholder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions theme/imageuploadprogress.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ figure.image {
transition-timing-function: linear;
}

&.ck-image-upload-placeholder > img {
width: 100%;
}

// Upload progress bar.
.ck-progress-bar {
height: 2px;
Expand Down

0 comments on commit edb5e81

Please sign in to comment.