Skip to content

Commit

Permalink
Remove unneeded pattern overrides translation strings (#59269)
Browse files Browse the repository at this point in the history
Co-authored-by: kevin940726 <kevin940726@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>
  • Loading branch information
3 people authored and getdave committed Feb 27, 2024
1 parent f5cb6f6 commit ac0c44e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
6 changes: 3 additions & 3 deletions packages/patterns/src/components/partial-syncing-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { PARTIAL_SYNCING_SUPPORTED_BLOCKS } from '../constants';

function PartialSyncingControls( { name, attributes, setAttributes } ) {
const syncedAttributes = PARTIAL_SYNCING_SUPPORTED_BLOCKS[ name ];
const attributeSources = Object.keys( syncedAttributes ).map(
const attributeSources = syncedAttributes.map(
( attributeName ) =>
attributes.metadata?.bindings?.[ attributeName ]?.source
);
Expand All @@ -36,7 +36,7 @@ function PartialSyncingControls( { name, attributes, setAttributes } ) {
};

if ( ! isChecked ) {
for ( const attributeName of Object.keys( syncedAttributes ) ) {
for ( const attributeName of syncedAttributes ) {
if (
updatedBindings[ attributeName ]?.source ===
'core/pattern-overrides'
Expand All @@ -56,7 +56,7 @@ function PartialSyncingControls( { name, attributes, setAttributes } ) {
return;
}

for ( const attributeName of Object.keys( syncedAttributes ) ) {
for ( const attributeName of syncedAttributes ) {
if ( ! updatedBindings[ attributeName ] ) {
updatedBindings[ attributeName ] = {
source: 'core/pattern-overrides',
Expand Down
23 changes: 4 additions & 19 deletions packages/patterns/src/constants.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';

export const PATTERN_TYPES = {
theme: 'pattern',
user: 'wp_block',
Expand All @@ -22,18 +17,8 @@ export const PATTERN_SYNC_TYPES = {

// TODO: This should not be hardcoded. Maybe there should be a config and/or an UI.
export const PARTIAL_SYNCING_SUPPORTED_BLOCKS = {
'core/paragraph': { content: __( 'Content' ) },
'core/heading': { content: __( 'Content' ) },
'core/button': {
text: __( 'Text' ),
url: __( 'URL' ),
linkTarget: __( 'Link Target' ),
rel: __( 'Link Relationship' ),
},
'core/image': {
id: __( 'Image ID' ),
url: __( 'URL' ),
title: __( 'Title' ),
alt: __( 'Alt Text' ),
},
'core/paragraph': [ 'content' ],
'core/heading': [ 'content' ],
'core/button': [ 'text', 'url', 'linkTarget', 'rel' ],
'core/image': [ 'id', 'url', 'title', 'alt' ],
};

0 comments on commit ac0c44e

Please sign in to comment.