From 5f140a6111e260033340ab4b7ef163ada13cdaae Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Tue, 8 Mar 2022 17:47:15 +1100 Subject: [PATCH] Widget Group: Make `save()` markup the same as `render_callback` markup (#38510) --- .../src/blocks/widget-group/deprecated.js | 32 +++++++++++++++++++ .../widgets/src/blocks/widget-group/index.js | 3 ++ .../widgets/src/blocks/widget-group/save.js | 4 ++- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 packages/widgets/src/blocks/widget-group/deprecated.js diff --git a/packages/widgets/src/blocks/widget-group/deprecated.js b/packages/widgets/src/blocks/widget-group/deprecated.js new file mode 100644 index 00000000000000..f885a1a25d80b1 --- /dev/null +++ b/packages/widgets/src/blocks/widget-group/deprecated.js @@ -0,0 +1,32 @@ +/** + * WordPress dependencies + */ +import { InnerBlocks, RichText } from '@wordpress/block-editor'; + +const v1 = { + attributes: { + title: { + type: 'string', + }, + }, + supports: { + html: false, + inserter: true, + customClassName: true, + reusable: false, + }, + save( { attributes } ) { + return ( + <> + + + + ); + }, +}; + +export default [ v1 ]; diff --git a/packages/widgets/src/blocks/widget-group/index.js b/packages/widgets/src/blocks/widget-group/index.js index 012a4a0954bb24..4876d93d519500 100644 --- a/packages/widgets/src/blocks/widget-group/index.js +++ b/packages/widgets/src/blocks/widget-group/index.js @@ -11,6 +11,8 @@ import { group as icon } from '@wordpress/icons'; import metadata from './block.json'; import edit from './edit'; import save from './save'; +import deprecated from './deprecated'; + const { name } = metadata; export { metadata, name }; @@ -73,4 +75,5 @@ export const settings = { }, ], }, + deprecated, }; diff --git a/packages/widgets/src/blocks/widget-group/save.js b/packages/widgets/src/blocks/widget-group/save.js index 203d063c27ca05..be5ec73eca6c1c 100644 --- a/packages/widgets/src/blocks/widget-group/save.js +++ b/packages/widgets/src/blocks/widget-group/save.js @@ -11,7 +11,9 @@ export default function save( { attributes } ) { className="widget-title" value={ attributes.title } /> - +
+ +
); }