Conversation
|
Beside the minor comments I had, this LGTM 👍 Great work here! |
|
Thanks @Tug for the review! |
|
This looks good now 👍 |
c46abbd to
556b29b
Compare
556b29b to
b72c99b
Compare
| class ImageEdit extends Component { | ||
| constructor() { | ||
| super( ...arguments ); | ||
| this.onMediaLibraryPress = this.onMediaLibraryPress.bind( this ); |
There was a problem hiding this comment.
Hey @Tug ! I had to add this bind back since it was giving an error accessing this.props.setAttributes.
There was a problem hiding this comment.
Yep, usually onSomething methods need to be bound to this 👍
|
Thank you @Tug ! Everything should be fixed now. Ready for another look 👍 |
|
Thank you! |
| @@ -0,0 +1,9 @@ | |||
|
|
|||
| export function calculatePreferedImageSize( image, container ) { | |||
There was a problem hiding this comment.
Would be good to add some JSDocs :)
* [rnmobile]: Convert image-block into class * [rnmobile]: Creating mobile version of `image-size`. * [rnmobile]: Adding util to image-block to share math between image-size components. * [rnmobile]: Adding newline at the end of image-size.native.js file * [rnmobile]: Replace wrong tabs characters * [rnmobile]: Clear image size when url changes. * [rnmobile]: Fixed lint issues * [rnmobile]: Removing unnecessary binding calls * [rnmobile]: Added necessary this.onLayout.bind( this ) * [rnmobile]: Adding missing bind to `onMediaLibraryPress`.
* [rnmobile]: Convert image-block into class * [rnmobile]: Creating mobile version of `image-size`. * [rnmobile]: Adding util to image-block to share math between image-size components. * [rnmobile]: Adding newline at the end of image-size.native.js file * [rnmobile]: Replace wrong tabs characters * [rnmobile]: Clear image size when url changes. * [rnmobile]: Fixed lint issues * [rnmobile]: Removing unnecessary binding calls * [rnmobile]: Added necessary this.onLayout.bind( this ) * [rnmobile]: Adding missing bind to `onMediaLibraryPress`.
This PR takes over this (very old) PR #9975 to solve the issue wordpress-mobile/gutenberg-mobile#444
The image size implementations tries to follow closely the web implementation. I tried to share some code from
ImageSizebut most of it is platform specific. I made a smallutilsto share some math calculations.On a future PR I plan to implement some kind of loading indicator.
To test:
Refer to the
gutenberg-mobilePR.