// packages/block-library/src/term-description/edit.js
import clsx from "clsx";
import { __ } from "@wordpress/i18n";
import {
  useBlockProps,
  BlockControls,
  AlignmentControl
} from "@wordpress/block-editor";
import { useTermDescription } from "./use-term-description";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
function TermDescriptionEdit({
  attributes,
  setAttributes,
  mergedStyle,
  context: { termId, taxonomy }
}) {
  const { textAlign } = attributes;
  const { termDescription } = useTermDescription(termId, taxonomy);
  const blockProps = useBlockProps({
    className: clsx({
      [`has-text-align-${textAlign}`]: textAlign
    }),
    style: mergedStyle
  });
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx(BlockControls, { group: "block", children: /* @__PURE__ */ jsx(
      AlignmentControl,
      {
        value: textAlign,
        onChange: (nextAlign) => {
          setAttributes({ textAlign: nextAlign });
        }
      }
    ) }),
    /* @__PURE__ */ jsx("div", { ...blockProps, children: termDescription ? /* @__PURE__ */ jsx(
      "div",
      {
        dangerouslySetInnerHTML: { __html: termDescription }
      }
    ) : /* @__PURE__ */ jsx("div", { className: "wp-block-term-description__placeholder", children: /* @__PURE__ */ jsx("span", { children: __("Term Description") }) }) })
  ] });
}
export {
  TermDescriptionEdit as default
};
//# sourceMappingURL=edit.js.map
