UNPKG

@wordpress/block-library

Version:
42 lines (41 loc) 1.13 kB
// packages/block-library/src/preformatted/edit.js import { __ } from "@wordpress/i18n"; import { RichText, useBlockProps } from "@wordpress/block-editor"; import { createBlock, getDefaultBlockName } from "@wordpress/blocks"; import { jsx } from "react/jsx-runtime"; 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\u2026"), onMerge: mergeBlocks, ...blockProps, __unstablePastePlainText: true, __unstableOnSplitAtDoubleLineEnd: () => insertBlocksAfter(createBlock(getDefaultBlockName())) } ); } export { PreformattedEdit as default }; //# sourceMappingURL=edit.js.map