@wordpress/block-library
Version:
Block library for the WordPress editor.
26 lines (25 loc) • 762 B
JavaScript
import { createBlock, getBlockVariations, getDefaultBlockName } from "@wordpress/blocks";
// packages/block-library/src/separator/transforms.js
const transforms = {
from: [{
type: "input",
regExp: /^-{3,}$/,
transform: () => {
const defaultVariation = getBlockVariations("core/separator")?.find((variation) => variation.isDefault);
return [createBlock("core/separator", defaultVariation?.attributes ?? {}), createBlock(getDefaultBlockName())];
}
}, {
type: "raw",
selector: "hr",
schema: { hr: {} }
}],
to: [{
type: "block",
blocks: ["core/spacer"],
transform: ({ anchor }) => {
return createBlock("core/spacer", { anchor: anchor || void 0 });
}
}]
};
export { transforms as default };
//# sourceMappingURL=transforms.mjs.map