@wordpress/block-library
Version:
Block library for the WordPress editor.
8 lines (7 loc) • 4.14 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../src/form/deprecated.js"],
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tgetTypographyClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n} from '@wordpress/block-editor';\n\nconst v1 = {\n\t// The block supports here are deliberately empty despite this\n\t// deprecated version of the block having adopted block supports.\n\t// The attributes added by these supports have been manually\n\t// added to this deprecated version's attributes definition so\n\t// that the data isn't lost on migration. All this is so that the\n\t// automatic application of block support classes doesn't occur\n\t// as this version of the block had a bug that overrode those\n\t// classes. If those block support classes are applied during the\n\t// deprecation process, this deprecation doesn't match and won't\n\t// run.\n\t// @see https://github.com/WordPress/gutenberg/pull/55755\n\tsupports: {},\n\tattributes: {\n\t\tsubmissionMethod: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'email',\n\t\t},\n\t\tmethod: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'post',\n\t\t},\n\t\taction: {\n\t\t\ttype: 'string',\n\t\t},\n\t\temail: {\n\t\t\ttype: 'string',\n\t\t},\n\t\t// The following attributes have been added to match the block\n\t\t// supports at the time of the deprecation. See above for details.\n\t\tanchor: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'attribute',\n\t\t\tattribute: 'id',\n\t\t\tselector: '*',\n\t\t},\n\t\tbackgroundColor: {\n\t\t\ttype: 'string',\n\t\t},\n\t\ttextColor: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tgradient: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tstyle: {\n\t\t\ttype: 'object',\n\t\t},\n\t\tfontFamily: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tfontSize: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { submissionMethod } = attributes;\n\t\tconst colorProps = getColorClassesAndStyles( attributes );\n\t\tconst typographyProps = getTypographyClassesAndStyles( attributes );\n\t\tconst spacingProps = getSpacingClassesAndStyles( attributes );\n\t\tconst blockProps = useBlockProps.save( {\n\t\t\t// In this deprecated version, the block support is deliberately empty.\n\t\t\t// As a result, the useBlockProps.save() does not output style or id attributes,\n\t\t\t// so we apply them explicitly here.\n\t\t\tstyle: {\n\t\t\t\t...colorProps.style,\n\t\t\t\t...typographyProps.style,\n\t\t\t\t...spacingProps.style,\n\t\t\t},\n\t\t\tid: attributes.anchor,\n\t\t} );\n\n\t\treturn (\n\t\t\t<form\n\t\t\t\t{ ...blockProps }\n\t\t\t\tclassName=\"wp-block-form\"\n\t\t\t\tencType={ submissionMethod === 'email' ? 'text/plain' : null }\n\t\t\t>\n\t\t\t\t<InnerBlocks.Content />\n\t\t\t</form>\n\t\t);\n\t},\n};\n\nexport default [ v1 ];\n"],
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,0CAA0C;AAAA,EAC1C,4CAA4C;AAAA,OACtC;AAgFH;AA9EJ,IAAM,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYV,UAAU,CAAC;AAAA,EACX,YAAY;AAAA,IACX,kBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,IACP;AAAA,IACA,OAAO;AAAA,MACN,MAAM;AAAA,IACP;AAAA;AAAA;AAAA,IAGA,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,UAAU;AAAA,IACX;AAAA,IACA,iBAAiB;AAAA,MAChB,MAAM;AAAA,IACP;AAAA,IACA,WAAW;AAAA,MACV,MAAM;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