Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/block-editor/src/hooks/align.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ export function addAttribute( settings ) {
...settings.attributes,
align: {
type: 'string',
// Allow for '' since it is used by updateAlignment function
// in withToolbarControls for special cases with defined default values.
enum: [ ...ALL_ALIGNMENTS, '' ],
},
};
}
Expand Down
4 changes: 0 additions & 4 deletions packages/block-library/src/archives/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ function render_block_core_archives( $attributes ) {

$class = 'wp-block-archives';

if ( isset( $attributes['align'] ) ) {
$class .= " align{$attributes['align']}";
}

if ( isset( $attributes['className'] ) ) {
$class .= " {$attributes['className']}";
}
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/calendar/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ function render_block_core_calendar( $attributes ) {
}

$custom_class_name = empty( $attributes['className'] ) ? '' : ' ' . $attributes['className'];
$align_class_name = empty( $attributes['align'] ) ? '' : ' ' . "align{$attributes['align']}";

$output = sprintf(
'<div class="%1$s">%2$s</div>',
esc_attr( 'wp-block-calendar' . $custom_class_name . $align_class_name ),
esc_attr( 'wp-block-calendar' . $custom_class_name ),
get_calendar( true, false )
);

Expand Down
10 changes: 0 additions & 10 deletions packages/block-library/src/categories/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@
"name": "core/categories",
"category": "widgets",
"attributes": {
"align": {
"type": "string",
"enum": [
"left",
"center",
"right",
"wide",
"full"
]
},
"className": {
"type": "string"
},
Expand Down
4 changes: 0 additions & 4 deletions packages/block-library/src/categories/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ function render_block_core_categories( $attributes ) {

$class = "wp-block-categories wp-block-categories-{$type}";

if ( isset( $attributes['align'] ) ) {
$class .= " align{$attributes['align']}";
}

if ( isset( $attributes['className'] ) ) {
$class .= " {$attributes['className']}";
}
Expand Down
3 changes: 0 additions & 3 deletions packages/block-library/src/latest-comments/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ function render_block_core_latest_comments( $attributes = array() ) {
if ( ! empty( $attributes['className'] ) ) {
$class .= ' ' . $attributes['className'];
}
if ( isset( $attributes['align'] ) ) {
$class .= " align{$attributes['align']}";
}
if ( $attributes['displayAvatar'] ) {
$class .= ' has-avatars';
}
Expand Down
10 changes: 0 additions & 10 deletions packages/block-library/src/latest-posts/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@
"name": "core/latest-posts",
"category": "widgets",
"attributes": {
"align": {
"type": "string",
"enum": [
"left",
"center",
"right",
"wide",
"full"
]
},
"className": {
"type": "string"
},
Expand Down
3 changes: 0 additions & 3 deletions packages/block-library/src/latest-posts/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ function render_block_core_latest_posts( $attributes ) {
remove_filter( 'excerpt_length', 'block_core_latest_posts_get_excerpt_length', 20 );

$class = 'wp-block-latest-posts wp-block-latest-posts__list';
if ( isset( $attributes['align'] ) ) {
$class .= ' align' . $attributes['align'];
}

if ( isset( $attributes['postLayout'] ) && 'grid' === $attributes['postLayout'] ) {
$class .= ' is-grid';
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ function render_block_core_navigation( $attributes, $content, $block ) {
array( 'wp-block-navigation' ),
isset( $attributes['className'] ) ? array( $attributes['className'] ) : array(),
( isset( $attributes['orientation'] ) && 'vertical' === $attributes['orientation'] ) ? array( 'is-vertical' ) : array(),
isset( $attributes['itemsJustification'] ) ? array( 'items-justified-' . $attributes['itemsJustification'] ) : array(),
isset( $attributes['align'] ) ? array( 'align' . $attributes['align'] ) : array()
isset( $attributes['itemsJustification'] ) ? array( 'items-justified-' . $attributes['itemsJustification'] ) : array()
);
$class_attribute = sprintf( ' class="%s"', esc_attr( implode( ' ', $classes ) ) );
$style_attribute = ( $colors['inline_styles'] || $font_sizes['inline_styles'] )
Expand Down
4 changes: 0 additions & 4 deletions packages/block-library/src/rss/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ function render_block_core_rss( $attributes ) {
}

$class = 'wp-block-rss';
if ( isset( $attributes['align'] ) ) {
$class .= ' align' . $attributes['align'];
}

if ( isset( $attributes['blockLayout'] ) && 'grid' === $attributes['blockLayout'] ) {
$class .= ' is-grid';
}
Expand Down
10 changes: 0 additions & 10 deletions packages/block-library/src/search/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@
"name": "core/search",
"category": "widgets",
"attributes": {
"align": {
"type": "string",
"enum": [
"left",
"center",
"right",
"wide",
"full"
]
},
"className": {
"type": "string"
},
Expand Down
3 changes: 0 additions & 3 deletions packages/block-library/src/search/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ function render_block_core_search( $attributes ) {
if ( isset( $attributes['className'] ) ) {
$class .= ' ' . $attributes['className'];
}
if ( isset( $attributes['align'] ) ) {
$class .= ' align' . $attributes['align'];
}

return sprintf(
'<form class="%s" role="search" method="get" action="%s">%s</form>',
Expand Down
4 changes: 1 addition & 3 deletions packages/block-library/src/tag-cloud/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
* @return string Returns the tag cloud for selected taxonomy.
*/
function render_block_core_tag_cloud( $attributes ) {
$class = isset( $attributes['align'] ) ?
"wp-block-tag-cloud align{$attributes['align']}" :
'wp-block-tag-cloud';
$class = 'wp-block-tag-cloud';

if ( isset( $attributes['className'] ) ) {
$class .= ' ' . $attributes['className'];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- wp:button {"borderRadius":0,"align":"none","style":{"color":{"text":"#1b9b6c","background":"#aa5a20"}}} -->
<!-- wp:button {"borderRadius":0,"style":{"color":{"text":"#1b9b6c","background":"#aa5a20"}}} -->
<div class="wp-block-button"><a class="wp-block-button__link no-border-radius has-text-color has-background" style="background-color:#aa5a20;color:#1b9b6c">My button</a></div>
<!-- /wp:button -->
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"text": "#1b9b6c",
"background": "#aa5a20"
}
},
"align": "none"
}
},
"innerBlocks": [],
"originalContent": "<div class=\"wp-block-button\"><a class=\"wp-block-button__link no-border-radius has-text-color has-background\" style=\"background-color:#aa5a20;color:#1b9b6c\">My button</a></div>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"blockName": "core/button",
"attrs": {
"borderRadius": 0,
"align": "none",
"style": {
"color": {
"text": "#1b9b6c",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- wp:button {"borderRadius":0,"style":{"color":{"text":"#1b9b6c","background":"#aa5a20"}},"align":"none"} -->
<!-- wp:button {"borderRadius":0,"style":{"color":{"text":"#1b9b6c","background":"#aa5a20"}}} -->
<div class="wp-block-button"><a class="wp-block-button__link has-text-color has-background no-border-radius" style="background-color:#aa5a20;color:#1b9b6c">My button</a></div>
<!-- /wp:button -->