-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Image Block] Set default values of the width and height input fields according to the actual image dimensions #7687
Conversation
The changes look good to me but tests are failing. Seems unrelated to the changes? |
It looks like this PR needs to be updated to align with the latest changes from master branch. |
…the actual image dimensions
PR is refreshed, thank you for the review @gziolo ❤️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really nice improvement 👍
Nice work, thanks for being so patient to wait until this PR gets reviewed and refreshing it so quickly. Thank you for your contribution 💯
Thank you for the merge and for your kind words @gziolo ❤️ |
…rnmobile/372-use-RichText-on-Title-block * 'master' of https://github.com/WordPress/gutenberg: (22 commits) Make the modal title styling consistent (#13669) Disable navigation block for text mode. (#12185) Fix: Linting problem in modal example code (#13671) Add myself as a code owner to the annotations (#13672) Add more reviewers to CODEOWNERS.md file (#13667) Plugin: Remove jQuery heartbeat-to-hooks proxying (#13576) Workflow: Add repository CODEOWNERS file (#13604) Add a mobile minimum size for form fields (#13639) Update edit-save documentation (#13578) Alt image setting (#13631) Fix: Allow years lower than 1970 in DateTime component. (#13602) Using addQueryArgs to generate Manage All Reusable Blocks link (#13653) Bump plugin version to 5.0.0-rc.1 (#13652) Update lodash to 4.17.10 (#13651) Refreshed PR (#9469) Set default values of the width and height input fields according to the actual image dimensions (#7687) 12647 fix css color picker (#12747) Remove "we" from messages (#13644) Fix: Font size picker max width on mobile (#13264) Fix/issue 12501 menu item aria label ...
…the actual image dimensions (#7687)
…the actual image dimensions (#7687)
Description
Fixes #7638.
This PR addresses #7638 which reports the unexpected behavior of changing the input values, as the placeholder shows the actual image dimensions but pressing the up/down arrows of the number input fields start their values from
0
.This PR strips out the placeholder from the mentioned fields and sets the actual dimensions as the default field values. The default values don't take effect until they are changed and when they are changed, values start changing from the displayed width or height values, which is described as the expected behavior in #7638.
How has this been tested?
This has been tested by going through the following steps:
The values should start changing from the actual image dimensions, as opposed to the previous behavior which started the change from
0
. It has also been made sure that the default values do not take effect on the image until the field values are actually changed.This was tested in WP 4.9.6, Gutenberg 3.1.1, Apache server with PHP 7.2.0 and MySQL 5.6.34. According to initial tests, the code doesn’t seem to affect any other areas.
Types of changes
This PR removes the
placeholder
attribute from the width and height numberinput
fields. Then it sets theimageWidth
andimageHeight
variables in place of the blankvalue
attribute when the dimensions areundefined
.Checklist: