UNPKG

@wordpress/block-library

Version:
39 lines (38 loc) • 1.68 kB
import { __ } from "@wordpress/i18n"; import { RichText, useBlockProps } from "@wordpress/block-editor"; import { createBlock, getDefaultBlockName } from "@wordpress/blocks"; import { Figure } from "./figure.mjs"; import { BlockQuote } from "./blockquote.mjs"; import useDeprecatedTextAlign from "../utils/deprecated-text-align-attributes.mjs"; import { Fragment, jsx, jsxs } from "react/jsx-runtime"; // packages/block-library/src/pullquote/edit.jsx function PullQuoteEdit(props) { const { attributes, setAttributes, isSelected, insertBlocksAfter } = props; useDeprecatedTextAlign(props); const { citation, value } = attributes; const blockProps = useBlockProps(); const shouldShowCitation = !RichText.isEmpty(citation) || isSelected; return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Figure, { ...blockProps, children: /* @__PURE__ */ jsxs(BlockQuote, { children: [/* @__PURE__ */ jsx(RichText, { identifier: "value", tagName: "p", value, onChange: (nextValue) => setAttributes({ value: nextValue }), "aria-label": __("Pullquote text"), placeholder: __("Add quote") }), shouldShowCitation && /* @__PURE__ */ jsx(RichText, { identifier: "citation", tagName: "cite", style: { display: "block" }, value: citation, "aria-label": __("Pullquote citation text"), placeholder: __("Add citation"), onChange: (nextCitation) => setAttributes({ citation: nextCitation }), className: "wp-block-pullquote__citation", __unstableOnSplitAtEnd: insertBlocksAfter ? () => insertBlocksAfter(createBlock(getDefaultBlockName())) : void 0 })] }) }) }); } export { PullQuoteEdit as default }; //# sourceMappingURL=edit.mjs.map