@wordpress/block-library
Version:
Block library for the WordPress editor.
1 lines • 5.39 kB
Source Map (JSON)
{"version":3,"file":"deprecated.mjs","names":[],"sources":["../../src/verse/deprecated.jsx"],"sourcesContent":["import clsx from 'clsx';\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport migrateFontFamily from '../utils/migrate-font-family';\nimport migrateTextAlign from '../utils/migrate-text-align';\n\nconst v1 = {\n\tattributes: {\n\t\tcontent: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'html',\n\t\t\tselector: 'pre',\n\t\t\tdefault: '',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { textAlign, content } = attributes;\n\n\t\treturn (\n\t\t\t<RichText.Content\n\t\t\t\ttagName=\"pre\"\n\t\t\t\tstyle={ { textAlign } }\n\t\t\t\tvalue={ content }\n\t\t\t/>\n\t\t);\n\t},\n\tmigrate: migrateTextAlign,\n};\n\nconst v2 = {\n\tattributes: {\n\t\tcontent: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'html',\n\t\t\tselector: 'pre',\n\t\t\tdefault: '',\n\t\t\t__unstablePreserveWhiteSpace: true,\n\t\t\trole: 'content',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsupports: {\n\t\tanchor: true,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t},\n\t\tspacing: {\n\t\t\tpadding: true,\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { textAlign, content } = attributes;\n\n\t\tconst className = clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} );\n\n\t\treturn (\n\t\t\t<pre { ...useBlockProps.save( { className } ) }>\n\t\t\t\t<RichText.Content value={ content } />\n\t\t\t</pre>\n\t\t);\n\t},\n\tmigrate( attributes ) {\n\t\treturn migrateTextAlign( migrateFontFamily( attributes ) );\n\t},\n\tisEligible( { style, textAlign } ) {\n\t\treturn style?.typography?.fontFamily || !! textAlign;\n\t},\n};\n\nconst v3 = {\n\tattributes: {\n\t\tcontent: {\n\t\t\ttype: 'rich-text',\n\t\t\tsource: 'rich-text',\n\t\t\tselector: 'pre',\n\t\t\t__unstablePreserveWhiteSpace: true,\n\t\t\trole: 'content',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsupports: {\n\t\tanchor: true,\n\t\tbackground: {\n\t\t\tbackgroundImage: true,\n\t\t\tbackgroundSize: true,\n\t\t},\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t},\n\t\tdimensions: {\n\t\t\tminHeight: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalWritingMode: true,\n\t\t},\n\t\tspacing: {\n\t\t\tmargin: true,\n\t\t\tpadding: true,\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\twidth: true,\n\t\t\tcolor: true,\n\t\t\tstyle: true,\n\t\t},\n\t\tinteractivity: {\n\t\t\tclientNavigation: true,\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { textAlign, content } = attributes;\n\n\t\tconst className = clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} );\n\n\t\treturn (\n\t\t\t<pre { ...useBlockProps.save( { className } ) }>\n\t\t\t\t<RichText.Content value={ content } />\n\t\t\t</pre>\n\t\t);\n\t},\n\tmigrate: migrateTextAlign,\n\tisEligible( attributes ) {\n\t\treturn (\n\t\t\t!! attributes.textAlign ||\n\t\t\t!! attributes.className?.match(\n\t\t\t\t/\\bhas-text-align-(left|center|right)\\b/\n\t\t\t)\n\t\t);\n\t},\n};\n\n/**\n * New deprecations need to be placed first\n * for them to have higher priority.\n *\n * Old deprecations may need to be updated as well.\n *\n * See block-deprecation.md\n */\nexport default [ v3, v2, v1 ];\n"],"mappings":";;;;;;;;;;;;;AAmKA,IAAA,qBAAe;CAAE;EAlFhB,YAAY;GACX,SAAS;IACR,MAAM;IACN,QAAQ;IACR,UAAU;IACV,8BAA8B;IAC9B,MAAM;GACP;GACA,WAAW,EACV,MAAM,SACP;EACD;EACA,UAAU;GACT,QAAQ;GACR,YAAY;IACX,iBAAiB;IACjB,gBAAgB;GACjB;GACA,OAAO;IACN,WAAW;IACX,MAAM;GACP;GACA,YAAY,EACX,WAAW,KACZ;GACA,YAAY;IACX,UAAU;IACV,0BAA0B;IAC1B,YAAY;IACZ,yBAAyB;IACzB,0BAA0B;IAC1B,6BAA6B;IAC7B,6BAA6B;IAC7B,8BAA8B;IAC9B,2BAA2B;GAC5B;GACA,SAAS;IACR,QAAQ;IACR,SAAS;GACV;GACA,sBAAsB;IACrB,QAAQ;IACR,OAAO;IACP,OAAO;IACP,OAAO;GACR;GACA,eAAe,EACd,kBAAkB,KACnB;EACD;EACA,KAAM,EAAE,cAAe;GACtB,MAAM,EAAE,WAAW,YAAY;GAE/B,MAAM,YAAY,KAAM,GACrB,kBAAmB,cAAgB,UACtC,CAAE;GAEF,OACC,oBAAC,OAAD;IAAK,GAAK,cAAc,KAAM,EAAE,UAAU,CAAE;IAC3C,UAAA,oBAAC,SAAS,SAAV,EAAkB,OAAQ,QAAW,CAAA;GACjC,CAAA;EAEP;EACA,SAAS;EACT,WAAY,YAAa;GACxB,OACC,CAAC,CAAE,WAAW,aACd,CAAC,CAAE,WAAW,WAAW,MACxB,wCACD;EAEF;CAWgB;CAAI;EAnIpB,YAAY;GACX,SAAS;IACR,MAAM;IACN,QAAQ;IACR,UAAU;IACV,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