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

Separator Block: Add style variations #728

Closed
jasmussen opened this issue May 9, 2017 · 5 comments
Closed

Separator Block: Add style variations #728

jasmussen opened this issue May 9, 2017 · 5 comments
Labels
[Feature] Blocks Overall functionality of blocks General Interface Parts of the UI which don't fall neatly under other labels. [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later

Comments

@jasmussen
Copy link
Contributor

We should add two or three style variations to the style block. Same UI as the one for quote styles.

  • Full width horizontal line, possibly default
  • Short, centered, horizontal line, currently in master
  • Three dots spaced out
@jasmussen jasmussen added [Feature] Blocks Overall functionality of blocks General Interface Parts of the UI which don't fall neatly under other labels. Design labels May 9, 2017
@mtias mtias added the [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later label May 9, 2017
@melchoyce
Copy link
Contributor

Should these styles be decided by themes instead of the editor?

@jasmussen
Copy link
Contributor Author

Should these styles be decided by themes instead of the editor?

Good question. The theme should absolutely be able to override them, but should the theme also bleed into the editor here? It overlaps with editor style territory.

@mtias
Copy link
Member

mtias commented Aug 18, 2017

Closing as this seems theme territory.

@mtias mtias closed this as completed Aug 18, 2017
@jbjanot
Copy link

jbjanot commented Apr 12, 2018

Hi,

Sorry if this is the incorrect place for asking this, but I can't find a way to add a style variation (like for a quote) to the separator block, and this topic is the closest I found to what I am looking for.
Is it possible to hook the separator block and add the ability to choose a variation (via a dropdown in the sidebar for example) ? I couldn't manage to find this in the handbook.

Thanks for any help you could provide.

@gziolo
Copy link
Member

gziolo commented Apr 13, 2018

Is it possible to hook the separator block and add the ability to choose a variation (via a dropdown in the sidebar for example) ? I couldn't manage to find this in the handbook.

@jbjanot, what you have described is a very similar use case to what we do internally in Gutenberg with blocks.BlockEdit hook. There are two examples you can look at:

registering a hook for the anchor control:
https://github.com/WordPress/gutenberg/blob/master/blocks/hooks/anchor.js#L107

hooks implementation with the callback function:
https://github.com/WordPress/gutenberg/blob/master/blocks/hooks/anchor.js#L59-L85

registering a hook for the custom class name control:
https://github.com/WordPress/gutenberg/blob/master/blocks/hooks/custom-class-name.js#L97

hooks implementation with the callback function:
https://github.com/WordPress/gutenberg/blob/master/blocks/hooks/custom-class-name.js#L50-L75

In your case you will rather want to use <InspectorControls> rather than <InspectorAdvancedControls />. You can also use props.name inside the callback function to make sure that such control is applied only to Separator block.

Let me know if you need more help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks General Interface Parts of the UI which don't fall neatly under other labels. [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later
Projects
None yet
Development

No branches or pull requests

5 participants