@wordpress/block-library
Version:
Block library for the WordPress editor.
66 lines (65 loc) • 3.32 kB
JavaScript
;
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
// \0rolldown/runtime.js
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
let _wordpress_i18n = require("@wordpress/i18n");
let _wordpress_block_editor = require("@wordpress/block-editor");
let _wordpress_blocks = require("@wordpress/blocks");
let __figure_js = require("./figure.cjs");
let __blockquote_js = require("./blockquote.cjs");
let ___utils_deprecated_text_align_attributes_js = require("../utils/deprecated-text-align-attributes.cjs");
___utils_deprecated_text_align_attributes_js = __toESM(___utils_deprecated_text_align_attributes_js);
let react_jsx_runtime = require("react/jsx-runtime");
// packages/block-library/src/pullquote/edit.jsx
function PullQuoteEdit(props) {
const { attributes, setAttributes, isSelected, insertBlocksAfter } = props;
(0, ___utils_deprecated_text_align_attributes_js.default)(props);
const { citation, value } = attributes;
const blockProps = (0, _wordpress_block_editor.useBlockProps)();
const shouldShowCitation = !_wordpress_block_editor.RichText.isEmpty(citation) || isSelected;
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__figure_js.Figure, {
...blockProps,
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__blockquote_js.BlockQuote, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_block_editor.RichText, {
identifier: "value",
tagName: "p",
value,
onChange: (nextValue) => setAttributes({ value: nextValue }),
"aria-label": (0, _wordpress_i18n.__)("Pullquote text"),
placeholder: (0, _wordpress_i18n.__)("Add quote")
}), shouldShowCitation && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_block_editor.RichText, {
identifier: "citation",
tagName: "cite",
style: { display: "block" },
value: citation,
"aria-label": (0, _wordpress_i18n.__)("Pullquote citation text"),
placeholder: (0, _wordpress_i18n.__)("Add citation"),
onChange: (nextCitation) => setAttributes({ citation: nextCitation }),
className: "wp-block-pullquote__citation",
__unstableOnSplitAtEnd: insertBlocksAfter ? () => insertBlocksAfter((0, _wordpress_blocks.createBlock)((0, _wordpress_blocks.getDefaultBlockName)())) : void 0
})] })
}) });
}
exports.default = PullQuoteEdit;
//# sourceMappingURL=edit.cjs.map