@wordpress/block-library
Version:
Block library for the WordPress editor.
25 lines (24 loc) • 1.16 kB
JavaScript
import { useBlockProps } from "@wordpress/block-editor";
import { useSelect } from "@wordpress/data";
import { __ } from "@wordpress/i18n";
import { store } from "@wordpress/core-data";
import useDeprecatedTextAlign from "../utils/deprecated-text-align-attributes.mjs";
import { Fragment, jsx } from "react/jsx-runtime";
// packages/block-library/src/post-author-biography/edit.jsx
function PostAuthorBiographyEdit(props) {
useDeprecatedTextAlign(props);
const { context: { postType, postId } } = props;
const { authorDetails } = useSelect((select) => {
const { getEditedEntityRecord, getUser } = select(store);
const _authorId = getEditedEntityRecord("postType", postType, postId)?.author;
return { authorDetails: _authorId ? getUser(_authorId) : null };
}, [postType, postId]);
const blockProps = useBlockProps();
const displayAuthorBiography = authorDetails?.description || __("Author Biography");
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", {
...blockProps,
dangerouslySetInnerHTML: { __html: displayAuthorBiography }
}) });
}
export { PostAuthorBiographyEdit as default };
//# sourceMappingURL=edit.mjs.map