@wordpress/block-library
Version:
Block library for the WordPress editor.
38 lines (37 loc) • 1.23 kB
JavaScript
// packages/block-library/src/freeform/migration-notice.js
import { Warning } from "@wordpress/block-editor";
import { Button } from "@wordpress/components";
import { createBlock, rawHandler } from "@wordpress/blocks";
import { __ } from "@wordpress/i18n";
import { jsx } from "react/jsx-runtime";
function MigrationNotice({ content, onReplace }) {
const actions = [
/* @__PURE__ */ jsx(
Button,
{
__next40pxDefaultSize: true,
variant: "primary",
onClick: () => onReplace(rawHandler({ HTML: content })),
children: __("Convert to blocks")
},
"convert-to-blocks"
),
/* @__PURE__ */ jsx(
Button,
{
__next40pxDefaultSize: true,
variant: "secondary",
onClick: () => onReplace(createBlock("core/html", { content })),
children: __("Convert to HTML")
},
"convert-to-html"
)
];
return /* @__PURE__ */ jsx(Warning, { actions, children: __(
"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."
) });
}
export {
MigrationNotice as default
};
//# sourceMappingURL=migration-notice.mjs.map