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

Documentation: Need examples of using and setting attributes with controls within PluginDocumentSettingPanel #19747

Open
seb86 opened this issue Jan 18, 2020 · 6 comments
Assignees
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Type] Developer Documentation Documentation for developers

Comments

@seb86
Copy link

seb86 commented Jan 18, 2020

There is an urgent need of examples on using controls when registering a PluginDocumentSettingPanel. I know this slot is still new but developers like me are already wanting to use it instead of old fashion Meta Box.

Creating the panel and adding the controls is fine but getting the attributes to set is what I am strugglering to get working. I thought it would be the same or similar to extending the InspectorControls for a block or many blocks, but the results are not a match and does not always allow editing ability specially with a number input.

Here is my code sample. https://gist.github.com/seb86/2e2c45c644df41fd2b09a07e5169c177

You will see that I am saving the values as meta data which I have already added support for the post type wp_block and works when saving, but setting the selection so the user knows a change or selection has been made does not.

If anyone can provide a little help as to what might be missing I would greatly appreciate it.

Thank you.

@nickhamze
Copy link

Maybe @ryanwelcher has an idea? I see many issues in the repo by him that deal with PluginDocumentSettingPanel

@gziolo gziolo added [Feature] Extensibility The ability to extend blocks or the editing experience [Type] Developer Documentation Documentation for developers labels Jan 20, 2020
@ryanwelcher ryanwelcher self-assigned this Feb 10, 2020
@ryanwelcher
Copy link
Contributor

@seb86 can you explain this a bit more?

You will see that I am saving the values as meta data which I have already added support for the post type wp_block and works when saving, but setting the selection so the user knows a change or selection has been made does not.

Are you meaning that there is no indication that the post needs to be saved after making changes?

@seb86
Copy link
Author

seb86 commented Feb 10, 2020

There is no indication that the user has selected anything period. I have already solved the issue now so the code I provided is old.

@ryanwelcher
Copy link
Contributor

@seb86 what selection are you referring to? I don't think I understand the use-case.

@seb86
Copy link
Author

seb86 commented Feb 10, 2020

Any selection on any control so a select control would not keep to what the user selected despite the value being updated.

I achieved what I wanted so you can look at this plugin for code examples.

Here is what I did for a SelectControl.

@fabiankaegy
Copy link
Member

@ryanwelcher is this issue still relevant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

No branches or pull requests

5 participants