Skip to content
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

Editor: Bind EditorPageOrder to Redux state #7166

Merged
merged 2 commits into from
Jul 29, 2016

Conversation

aduth
Copy link
Contributor

@aduth aduth commented Jul 29, 2016

Related: #6548

This pull request seeks to refactor the <EditorPageOrder /> component to use Redux state exclusively for both displaying the current value and editing the value of the menu_order post field. Unless I'm mistaken, this would be the first production editor field using Redux state.

It also makes minor usability improvements to render the <input /> as a proper number field, so that arrow keys can be used to change order and a number input is shown on mobile devices (at least iOS).

Testing instructions:

Verify that there are no regressions in using the page order field. Notably, ensure that the post becomes saveable after changing the order, and that saving the post persists the order in the current session and after refresh.

  1. Navigate to the page editor
  2. Select a site, if prompted
  3. Enter a title and/or content
  4. Save the post
  5. Expand the Page Attributes sidebar accordion
  6. Change the Order value
  7. Note that the Save button is shown
  8. Save the post
  9. Refresh the page
  10. Note that the Order value entered in step 6 is persisted

Test live: https://calypso.live/?branch=update/editor-redux-page-order

@aduth aduth added [Feature] Post/Page Editor The editor for editing posts and pages. [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jul 29, 2016
if ( isNaN( newOrder ) ) {
newOrder = 0;
editMenuOrder( event ) {
const newOrder = parseInt( event.target.value ) || 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

my favorite variable name. each time i read it, i must listen to https://www.youtube.com/watch?v=9GMjH1nR0ds

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wow, that music video...

Copy link
Contributor

Choose a reason for hiding this comment

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

Right?! Pretty cutting edge for back in the day

@timmyc timmyc added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jul 29, 2016
@timmyc
Copy link
Contributor

timmyc commented Jul 29, 2016

This is working well for me in pages and cpts as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Post/Page Editor The editor for editing posts and pages.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants