Skip to content

Commit

Permalink
Fix: Button block does not centers on the editor (#17063)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta authored and gziolo committed Aug 29, 2019
1 parent ebe779e commit c153ccd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 0 additions & 4 deletions packages/block-library/src/button/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ import {
const { getComputedStyle } = window;

const applyFallbackStyles = withFallbackStyles( ( node, ownProps ) => {
if ( node ) {
node.classList.add( 'wp-block-button-wrapper' );
}

const { textColor, backgroundColor } = ownProps;
const backgroundColorValue = backgroundColor && backgroundColor.color;
const textColorValue = textColor && textColor.color;
Expand Down
7 changes: 6 additions & 1 deletion packages/block-library/src/button/editor.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
.block-editor-block-list__block[data-type="core/button"] {
&[data-align="center"] {
text-align: center;
div[data-block] {
margin-left: auto;
margin-right: auto;
}
}

&[data-align="right"] {
Expand Down Expand Up @@ -76,6 +80,7 @@
}
}

.wp-block-button-wrapper {
// Display "table" is used because the button container should only wrap the content and not takes the full width.
div[data-type="core/button"] div[data-block] {
display: table;
}

0 comments on commit c153ccd

Please sign in to comment.