@wordpress/block-library
Version:
Block library for the WordPress editor.
8 lines (7 loc) • 2.39 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../src/freeform/migration-notice.js"],
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Warning } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { createBlock, rawHandler } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Block-level deprecation warning rendered when the\n * `gutenberg-classic-block-deprecation` experiment is enabled.\n *\n * Uses the same `Warning` primitive as `core/missing` so the experience is\n * visually consistent with how the editor already surfaces deprecated blocks,\n * and offers two migration actions - a primary \"Convert to blocks\", and a\n * secondary \"Convert to Custom HTML\".\n *\n * @param {Object} props\n * @param {string} props.content Raw HTML content of the Classic block.\n * @param {Function} props.onReplace Replace the current block with the given blocks.\n */\nexport default function MigrationNotice( { content, onReplace } ) {\n\tconst actions = [\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tkey=\"convert-to-blocks\"\n\t\t\tvariant=\"primary\"\n\t\t\tonClick={ () => onReplace( rawHandler( { HTML: content } ) ) }\n\t\t>\n\t\t\t{ __( 'Convert to blocks' ) }\n\t\t</Button>,\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tkey=\"convert-to-html\"\n\t\t\tvariant=\"secondary\"\n\t\t\tonClick={ () =>\n\t\t\t\tonReplace( createBlock( 'core/html', { content } ) )\n\t\t\t}\n\t\t>\n\t\t\t{ __( 'Convert to HTML' ) }\n\t\t</Button>,\n\t];\n\n\treturn (\n\t\t<Warning actions={ actions }>\n\t\t\t{ __(\n\t\t\t\t'The Classic block is being phased out. Convert this content to blocks for the best editing experience, or move it to a Custom HTML block to preserve the markup as-is.'\n\t\t\t) }\n\t\t</Warning>\n\t);\n}\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAwB;AACxB,wBAAuB;AACvB,oBAAwC;AACxC,kBAAmB;AAiBjB;AAFa,SAAR,gBAAkC,EAAE,SAAS,UAAU,GAAI;AACjE,QAAM,UAAU;AAAA,IACf;AAAA,MAAC;AAAA;AAAA,QACA,uBAAqB;AAAA,QAErB,SAAQ;AAAA,QACR,SAAU,MAAM,cAAW,0BAAY,EAAE,MAAM,QAAQ,CAAE,CAAE;AAAA,QAEzD,8BAAI,mBAAoB;AAAA;AAAA,MAJtB;AAAA,IAKL;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,uBAAqB;AAAA,QAErB,SAAQ;AAAA,QACR,SAAU,MACT,cAAW,2BAAa,aAAa,EAAE,QAAQ,CAAE,CAAE;AAAA,QAGlD,8BAAI,iBAAkB;AAAA;AAAA,MANpB;AAAA,IAOL;AAAA,EACD;AAEA,SACC,4CAAC,+BAAQ,SACN;AAAA,IACD;AAAA,EACD,GACD;AAEF;",
"names": []
}