@wordpress/block-library
Version:
Block library for the WordPress editor.
1 lines • 2.79 kB
Source Map (JSON)
{"version":3,"file":"comments-legacy.cjs","names":["Button","__","useBlockProps","BlockControls","AlignmentControl","Warning","Placeholder"],"sources":["../../../src/comments/edit/comments-legacy.jsx"],"sourcesContent":["import clsx from 'clsx';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tWarning,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport Placeholder from './placeholder';\n\nexport default function CommentsLegacy( {\n\tattributes,\n\tsetAttributes,\n\tcontext: { postType, postId },\n} ) {\n\tconst { textAlign } = attributes;\n\n\tconst actions = [\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tkey=\"convert\"\n\t\t\tonClick={ () => void setAttributes( { legacy: false } ) }\n\t\t\tvariant=\"primary\"\n\t\t>\n\t\t\t{ __( 'Switch to editable mode' ) }\n\t\t</Button>,\n\t];\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning actions={ actions }>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Comments block: You’re currently using the legacy version of the block. ' +\n\t\t\t\t\t\t\t'The following is just a placeholder - the final styling will likely look different. ' +\n\t\t\t\t\t\t\t'For a better representation and more customization options, ' +\n\t\t\t\t\t\t\t'switch the block to its editable mode.'\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t\t<Placeholder postId={ postId } postType={ postType } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAwB,eAAgB,EACvC,YACA,eACA,SAAS,EAAE,UAAU,YAClB;CACH,MAAM,EAAE,cAAc;CAEtB,MAAM,UAAU,CACf,iBAAA,GAAA,kBAAA,IAAA,CAACA,sBAAAA,QAAD;EACC,uBAAA;EAEA,eAAgB,KAAK,cAAe,EAAE,QAAQ,MAAM,CAAE;EACtD,SAAQ;EAENC,WAAAA,GAAAA,gBAAAA,GAAAA,CAAI,yBAA0B;CACzB,GALH,SAKG,CACT;CAEA,MAAM,cAAA,GAAaC,wBAAAA,cAAAA,CAAe,EACjC,YAAA,GAAW,KAAA,QAAA,CAAM,GACd,kBAAmB,cAAgB,UACtC,CAAE,EACH,CAAE;CAEF,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,eAAD;EAAe,OAAM;EACpB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,kBAAD;GACC,OAAQ;GACR,WAAa,cAAe;IAC3B,cAAe,EAAE,WAAW,UAAU,CAAE;GACzC;EACA,CAAA;CACa,CAAA,GAEf,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,GAAK;EAAV,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,SAAD;GAAmB;GAChBJ,WAAAA,GAAAA,gBAAAA,GAAAA,CACD,gQAID;EACQ,CAAA,GACT,iBAAA,GAAA,kBAAA,IAAA,CAACK,kBAAAA,SAAD;GAAsB;GAAoB;EAAY,CAAA,CAClD;CACJ,CAAA,CAAA,EAAA,CAAA;AAEJ"}