Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"css-loader": "0.23.1",
"currency-codes": "^1.1.2",
"deep-freeze": "0.0.1",
"detect-browser": "^1.5.0",
"enzyme": "^2.4.1",
"eslint": "^3.11.1",
"eslint-config-defaults": "9.0.0",
Expand Down
13 changes: 10 additions & 3 deletions static/js/components/CropperWrapper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @flow
import React from 'react';
import Cropper from 'react-cropper';
import browser from 'detect-browser';

export default class CropperWrapper extends React.Component {
props: {
Expand All @@ -11,10 +12,16 @@ export default class CropperWrapper extends React.Component {

cropperHelper = () => {
const { updatePhotoEdit } = this.props;
let canvas = this.refs.cropper.getCroppedCanvas();
if (canvas.toBlob !== undefined) {
canvas.toBlob(blob => updatePhotoEdit(blob), 'image/jpeg');
let canvas;
if ( browser.name === 'safari' || browser.name === 'ios' ) {
canvas = this.refs.cropper.getCroppedCanvas();
} else {
canvas = this.refs.cropper.getCroppedCanvas({
width: 512,
height: 512,
});
}
canvas.toBlob(blob => updatePhotoEdit(blob), 'image/jpeg');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We used to check for toBlob here. Will it always exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we have a polyfill for it.

};

render () {
Expand Down