From 4a55288c692311acf8e0aac943390baa0a01b487 Mon Sep 17 00:00:00 2001 From: Ella <4710635+ellatrix@users.noreply.github.com> Date: Mon, 17 Jul 2023 18:42:40 +0200 Subject: [PATCH] Rich Text/Footnotes: fix getRichTextValues for useInnerBlocksProps.save (#52682) * Rich Text/Footnotes: fix getRichTextValues for useInnerBlocksProps.save * Address feedback --- .../src/components/rich-text/get-rich-text-values.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/rich-text/get-rich-text-values.js b/packages/block-editor/src/components/rich-text/get-rich-text-values.js index 4ecee9b76530e5..9af2eb054cf6c7 100644 --- a/packages/block-editor/src/components/rich-text/get-rich-text-values.js +++ b/packages/block-editor/src/components/rich-text/get-rich-text-values.js @@ -78,10 +78,20 @@ function addValuesForElements( children, ...args ) { } } +function _getSaveElement( name, attributes, innerBlocks ) { + return getSaveElement( + name, + attributes, + innerBlocks.map( ( block ) => + _getSaveElement( block.name, block.attributes, block.innerBlocks ) + ) + ); +} + function addValuesForBlocks( values, blocks ) { for ( let i = 0; i < blocks.length; i++ ) { const { name, attributes, innerBlocks } = blocks[ i ]; - const saveElement = getSaveElement( name, attributes ); + const saveElement = _getSaveElement( name, attributes, innerBlocks ); addValuesForElement( saveElement, values, innerBlocks ); } }