This repository was archived by the owner on Feb 27, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import PropTypes from 'prop-types'
7
7
* @author WebDevStudios
8
8
* @param {object } block The block data.
9
9
* @param {number } index A unique key required by React.
10
- * @return {Element } A block-based component.
10
+ * @return {Element } A block-based component.
11
11
*/
12
12
export default function displayBlock ( block , index ) {
13
13
const { attributes, name} = block
@@ -45,7 +45,7 @@ export default function displayBlock(block, index) {
45
45
case 'core/spacer' :
46
46
return < Blocks . BlockSpacer { ...attributes } key = { index } />
47
47
default :
48
- return < pre key = { index } > { JSON . stringify ( attributes , null , 2 ) } </ pre >
48
+ return < pre key = { index } > { JSON . stringify ( block , null , 2 ) } </ pre >
49
49
}
50
50
}
51
51
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ import getFormById from '@/api/wordpress/gravityForms/getFormById'
4
4
* Format and retrieve expanded block data.
5
5
*
6
6
* @author WebDevStudios
7
- * @param {Array } blocks Basic block data.
8
- * @return {Array } Formatted block data.
7
+ * @param {Array } blocks Basic block data.
8
+ * @return {Array } Formatted block data.
9
9
*/
10
10
export default async function formatBlockData ( blocks ) {
11
11
if ( ! blocks || ! blocks . length ) {
@@ -14,7 +14,7 @@ export default async function formatBlockData(blocks) {
14
14
15
15
return await Promise . all (
16
16
blocks . map ( async ( block ) => {
17
- const { name, attributes} = block
17
+ const { name, attributes, innerBlocks } = block
18
18
19
19
switch ( name ) {
20
20
case 'gravityforms/form' :
@@ -23,7 +23,9 @@ export default async function formatBlockData(blocks) {
23
23
break
24
24
}
25
25
26
- return { name, attributes}
26
+ const innerBlocksFormatted = await formatBlockData ( innerBlocks )
27
+
28
+ return { name, attributes, innerBlocks : innerBlocksFormatted }
27
29
} )
28
30
)
29
31
}
You can’t perform that action at this time.
0 commit comments