UNPKG

@wordpress/block-library

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