Skip to content

Fix #22892 and print classnames in spacer block on editor side - #23235

Merged
mkaz merged 1 commit into
WordPress:masterfrom
oxyc:spacer-classes
Oct 19, 2020
Merged

mkaz merged 1 commit into
WordPress:masterfrom
oxyc:spacer-classes

Conversation

@oxyc

@oxyc oxyc commented Jun 17, 2020 •

Copy link
Copy Markdown
Member

Description

Fixes issue where css classes are not added to the spacer block on the editor side.

Unfortunately I couldn't find a way to make this into a light block so that the wrapper element isnt printed. Tested out #23034 but as I suspected it didn't work. @ellatrix is there a way to do this or would it somehow be possible if useBlockProps() gets merged?

How has this been tested?

Ran wp.blocks.registerBlockStyle( 'core/spacer', { name: 'custom', label: 'Custom Style' } ); and tested adding a spacer with the style and with a custom class name.

Screenshots

Screen Shot 2020-06-17 at 08 23 38

Types of changes

Bug fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@oxyc
oxyc requested review from Soean, ajitbohra and talldan as code owners June 17, 2020 11:28
@oxyc oxyc added [Block] Spacer Affects the Spacer Block [Package] Block library /packages/block-library [Type] Bug An existing feature does not function as intended labels Jun 20, 2020
@oxyc
oxyc force-pushed the spacer-classes branch from 9bf168e to 3e0c1f8 Compare July 2, 2020 00:54

@jorgefilipecosta jorgefilipecosta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 👍

@mkaz
mkaz merged commit c5e1b4d into WordPress:master Oct 19, 2020
@mkaz

mkaz commented Oct 19, 2020

Copy link
Copy Markdown
Member

Rebased and merged 👍

@github-actions github-actions Bot added this to the Gutenberg 9.3 milestone Oct 19, 2020
@youknowriad

Copy link
Copy Markdown
Contributor

Hi there!

I'm not sure this is the right fix. Right now the className is duplicated because it's also added by useBlockProps. the className prop explicit passing is not something we should stop doing. Why do we need this classname on the inner div? Isn't the outer div enough?

@oxyc

oxyc commented Nov 3, 2020 •

Copy link
Copy Markdown
Member Author

I opened this PR pre-useBlockProps, and never tested it since it got merged and this block started using it.

As far as i understand 0f09f1a#diff-2b919cfc2fabd55455cb2ca4c5c6a77a79c29b9def8b49deaa4cbeb01bc17a0c actually superseded this PR and it wasn't needed anymore. I think it's safe to revert this PR

@youknowriad

Copy link
Copy Markdown
Contributor

@oxyc I'll revert this one then :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Spacer Affects the Spacer Block [Package] Block library /packages/block-library [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants