@wordpress/block-library
Version:
Block library for the WordPress editor.
20 lines (19 loc) • 718 B
JavaScript
;
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let _wordpress_blocks = require("@wordpress/blocks");
let _wordpress_rich_text = require("@wordpress/rich-text");
// packages/block-library/src/html/transforms.js
const transforms = { from: [{
type: "block",
blocks: ["core/code"],
transform: ({ content: html }) => {
const text = (0, _wordpress_rich_text.create)({ html }).text;
const [block] = (0, _wordpress_blocks.parse)(`<!-- wp:html -->\n${text}\n<!-- /wp:html -->`);
return block ?? (0, _wordpress_blocks.createBlock)("core/html", {}, [], [text]);
}
}] };
exports.default = transforms;
//# sourceMappingURL=transforms.cjs.map