Skip to content

Commit

Permalink
https://github.com/editor-js/personality/pull/16
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitrov-adrian committed Dec 6, 2020
1 parent 481d038 commit d8eb078
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

15 changes: 6 additions & 9 deletions src/custom-blocks/plugin-personality-patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ export default class extends Personality {
onError: (error) => this.uploadingFailed(error),
});
}
preparePhotoUrl() {
let imageUrl = this.uploader.config.uploader.urlSigner(this.data.photo);
imageUrl += '&key=system-medium-cover';
return imageUrl;
setFullImageSource(photo) {
let photoSignedUrl = this.uploader.config.uploader.urlSigner(photo);
photoSignedUrl += '&key=system-medium-cover';
this.nodes.photo.style.background = `url('${photoSignedUrl}') center center / cover no-repeat`;
}
showFullImage() {
setTimeout(() => {
this.nodes.photo.classList.remove(this.CSS.loader);
this.nodes.photo.style.background = `url('${this.preparePhotoUrl(
this.data.photo
)}') center center / cover no-repeat`;
this.setFullImageSource(this.data.photo);
}, 500);
}
render() {
Expand All @@ -50,8 +48,7 @@ export default class extends Personality {
this.nodes.photo = this.make('div', this.CSS.photo);

if (photo) {
const preparedPhoto = this.preparePhotoUrl(photo);
this.nodes.photo.style.background = `url('${preparedPhoto}') center center / cover no-repeat`;
this.setFullImageSource(photo);
}

if (description) {
Expand Down

0 comments on commit d8eb078

Please sign in to comment.