Skip to content

Commit

Permalink
Tag Cloud: Add border block support (#63579)
Browse files Browse the repository at this point in the history
* Add border support to tag cloud block

* Prevent duplicate border styles in editor

* Add comments on style and edit component changes in tag cloud block

Co-authored-by: akasunil <[email protected]>
Co-authored-by: aaronrobertshaw <[email protected]>
  • Loading branch information
3 people authored Aug 12, 2024
1 parent da50610 commit d86a499
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
12 changes: 12 additions & 0 deletions packages/block-library/src/tag-cloud/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@
},
"interactivity": {
"clientNavigation": true
},
"__experimentalBorder": {
"radius": true,
"color": true,
"width": true,
"style": true,
"__experimentalDefaultControls": {
"radius": true,
"color": true,
"width": true,
"style": true
}
}
},
"editorStyle": "wp-block-tag-cloud-editor"
Expand Down
11 changes: 10 additions & 1 deletion packages/block-library/src/tag-cloud/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ function TagCloudEdit( { attributes, setAttributes } ) {
setAttributes( updateObj );
};

// Remove border styles from the server-side attributes to prevent duplicate border.
const serverSideAttributes = {
...attributes,
style: {
...attributes?.style,
border: undefined,
},
};

const inspectorControls = (
<InspectorControls>
<PanelBody title={ __( 'Settings' ) }>
Expand Down Expand Up @@ -188,7 +197,7 @@ function TagCloudEdit( { attributes, setAttributes } ) {
<ServerSideRender
skipBlockSupportAttributes
block="core/tag-cloud"
attributes={ attributes }
attributes={ serverSideAttributes }
/>
</Disabled>
</div>
Expand Down
4 changes: 3 additions & 1 deletion packages/block-library/src/tag-cloud/editor.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// The following styles are to prevent duplicate spacing for the tag cloud
// The following styles are to prevent duplicate spacing and border for the tag cloud
// block in the editor given it uses server side rendering. The specificity
// must be higher than `0-1-0` to override global styles. Targeting the
// inner use of the .wp-block-tag-cloud class should minimize impact on
// other 3rd party styles targeting the block.
.wp-block-tag-cloud .wp-block-tag-cloud {
margin: 0;
padding: 0;
border: none;
border-radius: inherit;
}

0 comments on commit d86a499

Please sign in to comment.