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

Fixed meta box configuration persistence to be per postType as in the classic editor. #5594

Merged
merged 1 commit into from Mar 19, 2018

Conversation

Projects
None yet
3 participants
@jorgefilipecosta
Copy link
Member

commented Mar 13, 2018

Fixes: #5512

We were calling window.postboxes.add_postbox_toggles with a fixed post type of 'post'. Now we call with the correct post type we are editing.
To do that, the post type was added to INITIALIZE_META_BOX_STATE action so our effects can correctly call add_postbox_toggles.

How Has This Been Tested?

Have at least 2 meta boxes (I used "Open Graph Metabox" and "Yoast SEO" plugins in my tests).
Open a post and change the order/collapsed state of the meta boxes.
Open a different post type and verify the last changes to meta box state don't affect this post type. I
In the CPT change the meta box state and verify the changes are persisted.
Verify that the classic editor shows exactly the same meta box ordering and collapsing state as Gutenberg and changes in the classic editor for posts and CPT's are reflected in Gutenberg and changes in Gutenberg are reflected in the classic editor.

@@ -27,7 +27,7 @@ const effects = {
}

// Allow toggling metaboxes panels
window.postboxes.add_postbox_toggles( 'post' );
window.postboxes.add_postbox_toggles( action.postType );

This comment has been minimized.

Copy link
@aduth

aduth Mar 16, 2018

Member

Is getCurrentPostType( store.getState() ) not an option?

This comment has been minimized.

Copy link
@jorgefilipecosta

jorgefilipecosta Mar 16, 2018

Author Member

Unfortunately no, getCurrentPostType is a selector from the editor store, here we are in the edit-post store and there is no information in this store referring postType.

This comment has been minimized.

Copy link
@youknowriad

youknowriad Mar 19, 2018

Contributor

I guess we can use wp.data.select( 'core/editor' ).getCurrentPostType() :)

This comment has been minimized.

Copy link
@jorgefilipecosta

jorgefilipecosta Mar 19, 2018

Author Member

Yes, we can do that, the code was updated. I had some fears that the initialization of the postType core/editor was after edit/post but that was not the case.

Fixed metabox configuration persistence to be per post_type as in cla…
…ssic editor.

We were calling window.postboxes.add_postbox_toggles with a fixed post type of 'post'. Now we call with the correct post type we are editing.

@jorgefilipecosta jorgefilipecosta force-pushed the fix/metabox-ordering branch from 86bdd16 to 4c702e8 Mar 19, 2018

@youknowriad
Copy link
Contributor

left a comment

LGTM 👍

@jorgefilipecosta jorgefilipecosta merged commit d189d54 into master Mar 19, 2018

2 checks passed

codecov/project 43.94% remains the same compared to 3ced7fb
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jorgefilipecosta jorgefilipecosta deleted the fix/metabox-ordering branch Mar 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.