// packages/block-library/src/preformatted/edit.js
import { __ } from "@wordpress/i18n";
import { RichText, useBlockProps } from "@wordpress/block-editor";
import { createBlock, getDefaultBlockName } from "@wordpress/blocks";
import { jsx } from "react/jsx-runtime";
function PreformattedEdit({
  attributes,
  mergeBlocks,
  setAttributes,
  onRemove,
  insertBlocksAfter,
  style
}) {
  const { content } = attributes;
  const blockProps = useBlockProps({ style });
  return /* @__PURE__ */ jsx(
    RichText,
    {
      tagName: "pre",
      identifier: "content",
      preserveWhiteSpace: true,
      value: content,
      onChange: (nextContent) => {
        setAttributes({
          content: nextContent
        });
      },
      onRemove,
      "aria-label": __("Preformatted text"),
      placeholder: __("Write preformatted text…"),
      onMerge: mergeBlocks,
      ...blockProps,
      __unstablePastePlainText: true,
      __unstableOnSplitAtDoubleLineEnd: () => insertBlocksAfter(createBlock(getDefaultBlockName()))
    }
  );
}
export {
  PreformattedEdit as default
};
//# sourceMappingURL=edit.mjs.map
