Fix `Single product` translations on edit mode (#50599)
* Format json * Get title and description from the registered block * Add changefile(s) from automation for the following project(s): woocommerce-blocks * Add empty array dep --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
5c980cc629
commit
d04666e35c
|
@ -17,12 +17,12 @@
|
|||
"productId": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
},
|
||||
"example": {
|
||||
"attributes": {
|
||||
"isPreview": true
|
||||
"isPreview": true
|
||||
}
|
||||
},
|
||||
},
|
||||
"usesContext": [ "postId", "postType", "queryId" ],
|
||||
"textdomain": "woocommerce",
|
||||
"apiVersion": 2,
|
||||
|
|
|
@ -53,6 +53,11 @@ const Editor = ( {
|
|||
const [ isEditing, setIsEditing ] = useState( ! productId );
|
||||
const blockProps = useBlockProps();
|
||||
|
||||
const block = useSelect(
|
||||
( select ) => select( 'core/blocks' ).getBlockType( metadata.name ),
|
||||
[]
|
||||
);
|
||||
|
||||
const productPreview = useSelect( ( select ) => {
|
||||
if ( ! isPreview ) {
|
||||
return null;
|
||||
|
@ -102,10 +107,10 @@ const Editor = ( {
|
|||
{ isEditing ? (
|
||||
<Placeholder
|
||||
icon={ BLOCK_ICON }
|
||||
label={ metadata.title }
|
||||
label={ block.title }
|
||||
className="wc-block-editor-single-product"
|
||||
>
|
||||
{ metadata.description }
|
||||
{ block.description }
|
||||
<div className="wc-block-editor-single-product__selection">
|
||||
<SharedProductControl
|
||||
attributes={ attributes }
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: fix
|
||||
|
||||
Single product block - Fix translation for title and description in edit mode.
|
Loading…
Reference in New Issue