@wordpress/block-library
Version:
Block library for the WordPress editor.
15 lines (14 loc) • 513 B
JavaScript
import { createBlock, parse } from "@wordpress/blocks";
import { create } from "@wordpress/rich-text";
// packages/block-library/src/html/transforms.js
const transforms = { from: [{
type: "block",
blocks: ["core/code"],
transform: ({ content: html }) => {
const text = create({ html }).text;
const [block] = parse(`<!-- wp:html -->\n${text}\n<!-- /wp:html -->`);
return block ?? createBlock("core/html", {}, [], [text]);
}
}] };
export { transforms as default };
//# sourceMappingURL=transforms.mjs.map