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

How to get Editor State #13632

Closed
fallinthehole opened this issue Feb 1, 2019 · 2 comments
Closed

How to get Editor State #13632

fallinthehole opened this issue Feb 1, 2019 · 2 comments
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.

Comments

@fallinthehole
Copy link

fallinthehole commented Feb 1, 2019

Hello! I have a pretty easy goal - i have parent component which has <InnerBlocks/>. Each inner block has index when i inspecting him via React dev tools. I want to get index of each inner block component by using method from gutenberg documentation: https://wordpress.org/gutenberg/handbook/designers-developers/developers/data/data-core-editor/#getblockindex

Each time it's returning -1. One of required arguments is editor state. So question is - how can i get this editor state. It should be obvious but seems like i missed something.

Thanks for help, appreciate your attention a lot!

@youknowriad youknowriad added the [Type] Help Request Help with setup, implementation, or "How do I?" questions. label Feb 1, 2019
@jayhill90
Copy link

#4105 may contain the information you're looking for.

@youknowriad
Copy link
Contributor

Hi there! thanks for the issue. This tracker is not used for support requests though. For general help requests, please post in the support forum at https://wordpress.org/support/forum/how-to-and-troubleshooting/. Technical help requests have their own section of the support forum at https://wordpress.org/support/forum/wp-advanced/.

You may also ask for technical support at https://wordpress.stackexchange.com/.

That said, you probably want to use the withSelect higher order component (it will automatically pass the state value, you should only pass the remaining arguments).

See the documentation of the data module https://developer.wordpress.org/block-editor/packages/packages-data/

This blog post might come handy as well.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.
Projects
None yet
Development

No branches or pull requests

3 participants