UNPKG

@wordpress/block-library

Version:
28 lines (27 loc) • 1.05 kB
import { __ } from "@wordpress/i18n"; import { RichText, useBlockProps } from "@wordpress/block-editor"; import { createBlock, getDefaultBlockName } from "@wordpress/blocks"; import { jsx } from "react/jsx-runtime"; // packages/block-library/src/preformatted/edit.jsx function PreformattedEdit({ attributes, mergeBlocks, setAttributes, onRemove, insertBlocksAfter, style }) { const { content } = attributes; const blockProps = useBlockProps({ style }); return /* @__PURE__ */ jsx(RichText, { tagName: "pre", identifier: "content", preserveWhiteSpace: true, value: content, onChange: (nextContent) => { setAttributes({ content: nextContent }); }, onRemove, "aria-label": __("Preformatted text"), placeholder: __("Write preformatted text…"), onMerge: mergeBlocks, ...blockProps, __unstablePastePlainText: true, __unstableOnSplitAtDoubleLineEnd: insertBlocksAfter ? () => insertBlocksAfter(createBlock(getDefaultBlockName())) : void 0 }); } export { PreformattedEdit as default }; //# sourceMappingURL=edit.mjs.map