Skip to content

Commit

Permalink
Rename the utils
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Sep 27, 2024
1 parent 47b223b commit 74f10dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/block-editor/src/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { PrivateBlockContext } from './private-block-context';

import { unlock } from '../../lock-unlock';

const { isBlockContentUnmodified } = unlock( blocksPrivateApis );
const { isUnmodifiedBlockContent } = unlock( blocksPrivateApis );

/**
* Merges wrapper props with special handling for classNames and styles.
Expand Down Expand Up @@ -355,7 +355,7 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => {
registry.batch( () => {
const firstBlock = getBlock( firstClientId );
const isFirstBlockContentUnmodified =
isBlockContentUnmodified( firstBlock );
isUnmodifiedBlockContent( firstBlock );
const defaultBlockName = getDefaultBlockName();
const replacement = switchToBlockType(
firstBlock,
Expand Down
4 changes: 2 additions & 2 deletions packages/blocks/src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getBlockBindingsSource,
getBlockBindingsSources,
} from './registration';
import { isBlockContentUnmodified } from './utils';
import { isUnmodifiedBlockContent } from './utils';

// The blocktype is the most important concept within the block API. It defines
// all aspects of the block configuration and its interfaces, including `edit`
Expand Down Expand Up @@ -184,5 +184,5 @@ lock( privateApis, {
unregisterBlockBindingsSource,
getBlockBindingsSource,
getBlockBindingsSources,
isBlockContentUnmodified,
isUnmodifiedBlockContent,
} );
8 changes: 4 additions & 4 deletions packages/blocks/src/api/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const ICON_COLORS = [ '#191e23', '#f8f9f9' ];
* @param {*} value The attribute's value.
* @return {boolean} Whether the attribute is unmodified.
*/
function isAttributeUnmodified( attributeDefinition, value ) {
function isUnmodifiedAttribute( attributeDefinition, value ) {
// Every attribute that has a default must match the default.
if ( attributeDefinition.hasOwnProperty( 'default' ) ) {
return value === attributeDefinition.default;
Expand Down Expand Up @@ -67,7 +67,7 @@ export function isUnmodifiedBlock( block ) {
( [ key, definition ] ) => {
const value = block.attributes[ key ];

return isAttributeUnmodified( definition, value );
return isUnmodifiedAttribute( definition, value );
}
);
}
Expand Down Expand Up @@ -95,7 +95,7 @@ export function isUnmodifiedDefaultBlock( block ) {
* @param {WPBlock} block Block Object
* @return {boolean} Whether the block content is unmodified.
*/
export function isBlockContentUnmodified( block ) {
export function isUnmodifiedBlockContent( block ) {
const contentAttributes = getBlockAttributesNamesByRole(
block.name,
'content'
Expand All @@ -109,7 +109,7 @@ export function isBlockContentUnmodified( block ) {
const definition = getBlockType( block.name )?.attributes[ key ];
const value = block.attributes[ key ];

return isAttributeUnmodified( definition, value );
return isUnmodifiedAttribute( definition, value );
} );
}

Expand Down

0 comments on commit 74f10dc

Please sign in to comment.