Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Allow url for button
  • Loading branch information
kevin940726 committed Jan 16, 2024
commit 585a658046cd0e699964fb3f70b261a30fcbadc0
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' ),
},
};