UNPKG

@wordpress/block-library

Version:
26 lines (25 loc) 628 B
// packages/block-library/src/html/transforms.js import { createBlock, parse } from "@wordpress/blocks"; import { create } from "@wordpress/rich-text"; var transforms = { from: [ { type: "block", blocks: ["core/code"], transform: ({ content: html }) => { const text = create({ html }).text; const [block] = parse( `<!-- wp:html --> ${text} <!-- /wp:html -->` ); return block ?? createBlock("core/html", {}, [], [text]); } } ] }; var transforms_default = transforms; export { transforms_default as default }; //# sourceMappingURL=transforms.mjs.map