[Product Block editor]: rename component edit function (#41741)

This commit is contained in:
Damián Suárez 2023-11-30 08:42:21 -03:00 committed by GitHub
commit bc9e2118c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 10 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: tweak
[Product Block editor]: rename component edit function

View File

@ -18,11 +18,12 @@ import { sanitizeHTML } from '../../../utils/sanitize-html';
import { SectionBlockAttributes } from './types'; import { SectionBlockAttributes } from './types';
import { ProductEditorBlockEditProps } from '../../../types'; import { ProductEditorBlockEditProps } from '../../../types';
export function Edit( { export function SectionBlockEdit( {
attributes, attributes,
clientId, clientId,
}: ProductEditorBlockEditProps< SectionBlockAttributes > ) { }: ProductEditorBlockEditProps< SectionBlockAttributes > ) {
const { description, title, blockGap } = attributes; const { description, title, blockGap } = attributes;
const blockProps = useWooBlockProps( attributes ); const blockProps = useWooBlockProps( attributes );
const innerBlockProps = useInnerBlocksProps( const innerBlockProps = useInnerBlocksProps(
{ {

View File

@ -7,7 +7,7 @@ import { registerProductEditorBlockType } from '../../../utils';
* Internal dependencies * Internal dependencies
*/ */
import blockConfiguration from './block.json'; import blockConfiguration from './block.json';
import { Edit } from './edit'; import { SectionBlockEdit } from './edit';
const { name, ...metadata } = blockConfiguration; const { name, ...metadata } = blockConfiguration;
@ -15,7 +15,7 @@ export { metadata, name };
export const settings = { export const settings = {
example: {}, example: {},
edit: Edit, edit: SectionBlockEdit,
}; };
export function init() { export function init() {

View File

@ -19,7 +19,7 @@ export interface TabBlockAttributes extends BlockAttributes {
isSelected?: boolean; isSelected?: boolean;
} }
export function Edit( { export function TabBlockEdit( {
setAttributes, setAttributes,
attributes, attributes,
context, context,

View File

@ -7,7 +7,7 @@ import { registerProductEditorBlockType } from '../../../utils';
* Internal dependencies * Internal dependencies
*/ */
import blockConfiguration from './block.json'; import blockConfiguration from './block.json';
import { Edit } from './edit'; import { TabBlockEdit } from './edit';
const { name, ...metadata } = blockConfiguration; const { name, ...metadata } = blockConfiguration;
@ -15,7 +15,7 @@ export { metadata, name };
export const settings = { export const settings = {
example: {}, example: {},
edit: Edit, edit: TabBlockEdit,
}; };
export function init() { export function init() {

View File

@ -46,7 +46,7 @@ function clearDescriptionIfEmpty( blocks: BlockInstance[] ) {
return blocks; return blocks;
} }
export function Edit( { export function DescriptionBlockEdit( {
attributes, attributes,
}: ProductEditorBlockEditProps< BlockAttributes > ) { }: ProductEditorBlockEditProps< BlockAttributes > ) {
const blockProps = useWooBlockProps( attributes ); const blockProps = useWooBlockProps( attributes );

View File

@ -2,7 +2,7 @@
* Internal dependencies * Internal dependencies
*/ */
import blockConfiguration from './block.json'; import blockConfiguration from './block.json';
import { Edit } from './edit'; import { DescriptionBlockEdit } from './edit';
import { registerProductEditorBlockType } from '../../../utils'; import { registerProductEditorBlockType } from '../../../utils';
const { name, ...metadata } = blockConfiguration; const { name, ...metadata } = blockConfiguration;
@ -11,7 +11,7 @@ export { metadata, name };
export const settings = { export const settings = {
example: {}, example: {},
edit: Edit, edit: DescriptionBlockEdit,
}; };
export const init = () => export const init = () =>

View File

@ -11,7 +11,7 @@ import { useState } from '@wordpress/element';
* Internal dependencies * Internal dependencies
*/ */
import { Tabs } from '../'; import { Tabs } from '../';
import { Edit as Tab } from '../../../blocks/generic/tab/edit'; import { TabBlockEdit as Tab } from '../../../blocks/generic/tab/edit';
jest.mock( '@woocommerce/block-templates', () => ( { jest.mock( '@woocommerce/block-templates', () => ( {
...jest.requireActual( '@woocommerce/block-templates' ), ...jest.requireActual( '@woocommerce/block-templates' ),