@wordpress/block-library
Version:
Block library for the WordPress editor.
1 lines • 2.01 kB
Source Map (JSON)
{"version":3,"file":"deprecated.cjs","names":["useBlockProps","InnerBlocks"],"sources":["../../src/comments/deprecated.jsx"],"sourcesContent":["import { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\n\n// v1: Deprecate the initial version of the block which was called \"Comments\n// Query Loop\" instead of \"Comments\".\nconst v1 = {\n\tattributes: {\n\t\ttagName: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'div',\n\t\t},\n\t},\n\tapiVersion: 3,\n\tsupports: {\n\t\talign: [ 'wide', 'full' ],\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tbackground: true,\n\t\t\t\ttext: true,\n\t\t\t\tlink: true,\n\t\t\t},\n\t\t},\n\t},\n\tsave( { attributes: { tagName: Tag } } ) {\n\t\tconst blockProps = useBlockProps.save();\n\t\tconst { className } = blockProps;\n\t\tconst classes = className?.split( ' ' ) || [];\n\n\t\t// The ID of the previous version of the block\n\t\t// didn't have the `wp-block-comments` class,\n\t\t// so we need to remove it here in order to mimic it.\n\t\tconst newClasses = classes?.filter(\n\t\t\t( cls ) => cls !== 'wp-block-comments'\n\t\t);\n\t\tconst newBlockProps = {\n\t\t\t...blockProps,\n\t\t\tclassName: newClasses.join( ' ' ),\n\t\t};\n\n\t\treturn (\n\t\t\t<Tag { ...newBlockProps }>\n\t\t\t\t<InnerBlocks.Content />\n\t\t\t</Tag>\n\t\t);\n\t},\n};\n\nexport default [ v1 ];\n"],"mappings":";;;;;;;AAiDA,IAAA,qBAAe,CAAE;CA5ChB,YAAY,EACX,SAAS;EACR,MAAM;EACN,SAAS;CACV,EACD;CACA,YAAY;CACZ,UAAU;EACT,OAAO,CAAE,QAAQ,MAAO;EACxB,MAAM;EACN,OAAO;GACN,WAAW;GACX,MAAM;GACN,+BAA+B;IAC9B,YAAY;IACZ,MAAM;IACN,MAAM;GACP;EACD;CACD;CACA,KAAM,EAAE,YAAY,EAAE,SAAS,SAAU;EACxC,MAAM,aAAaA,wBAAAA,cAAc,KAAK;EACtC,MAAM,EAAE,cAAc;EAMtB,MAAM,cALU,WAAW,MAAO,GAAI,KAAK,CAAC,EAAA,EAKhB,QACzB,QAAS,QAAQ,mBACpB;EACA,MAAM,gBAAgB;GACrB,GAAG;GACH,WAAW,WAAW,KAAM,GAAI;EACjC;EAEA,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;GAAK,GAAK;GACT,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,YAAY,SAAb,CAAsB,CAAA;EAClB,CAAA;CAEP;AAGgB,CAAG"}