Skip to content

Commit

Permalink
Allow url for button
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Jan 16, 2024
1 parent 38818e2 commit 585a658
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/block-library/src/block/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function applyInitialOverrides( blocks, overrides = {}, defaultValues ) {
defaultValues[ blockId ] ??= {};
defaultValues[ blockId ][ attributeKey ] =
block.attributes[ attributeKey ];
if ( overrides[ blockId ] ) {
if ( overrides[ blockId ]?.[ attributeKey ] !== undefined ) {
newAttributes[ attributeKey ] =
overrides[ blockId ][ attributeKey ];
}
Expand Down Expand Up @@ -134,6 +134,8 @@ function getOverridesFromBlocks( blocks, defaultValues ) {
defaultValues[ blockId ][ attributeKey ]
) {
overrides[ blockId ] ??= {};
// TODO: We need a way to represent `undefined` in the serialized overrides.
// Also see: https://github.com/WordPress/gutenberg/pull/57249#discussion_r1452987871
overrides[ blockId ][ attributeKey ] =
block.attributes[ attributeKey ];
}
Expand Down
5 changes: 4 additions & 1 deletion packages/patterns/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@ export const PATTERN_SYNC_TYPES = {
export const PARTIAL_SYNCING_SUPPORTED_BLOCKS = {
'core/paragraph': { content: __( 'Content' ) },
'core/heading': { content: __( 'Content' ) },
'core/button': { text: __( 'Text' ) },
'core/button': {
text: __( 'Text' ),
url: __( 'URL' ),
},
};

0 comments on commit 585a658

Please sign in to comment.