import { jsxDEV } from "react/jsx-dev-runtime";
import { EditorBlockBoundary } from "@contember/ui";
import { memo } from "react";
import { useSlateStatic, ReactEditor } from "slate-react";
import { useMessageFormatter } from "@contember/react-i18n";
import { ContemberEditor } from "../ContemberEditor/index.js";
import { editorDictionary } from "./editorDictionary.js";
const BlockElement = memo(function BlockElement2({
  element,
  children,
  attributes,
  domElement = "div",
  withBoundaries = false
}) {
  const editor = useSlateStatic();
  const dataAttributes = ContemberEditor.getElementDataAttributes(element);
  const El = domElement;
  const formatter = useMessageFormatter(editorDictionary);
  return /* @__PURE__ */ jsxDEV(El, { ...dataAttributes, ...attributes, children: [
    withBoundaries && /* @__PURE__ */ jsxDEV(
      EditorBlockBoundary,
      {
        blockEdge: "before",
        newParagraphText: formatter("editorBlock.editorBlockBoundary.newParagraph"),
        onClick: () => {
          const elementPath = ReactEditor.findPath(editor, element);
          editor.insertBetweenBlocks([element, elementPath], "before");
        }
      },
      void 0,
      false,
      {
        fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/richText/baseEditor/BlockElement.tsx",
        lineNumber: 28,
        columnNumber: 5
      },
      this
    ),
    children,
    withBoundaries && /* @__PURE__ */ jsxDEV(
      EditorBlockBoundary,
      {
        blockEdge: "after",
        newParagraphText: formatter("editorBlock.editorBlockBoundary.newParagraph"),
        onClick: () => {
          const elementPath = ReactEditor.findPath(editor, element);
          editor.insertBetweenBlocks([element, elementPath], "after");
        }
      },
      void 0,
      false,
      {
        fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/richText/baseEditor/BlockElement.tsx",
        lineNumber: 39,
        columnNumber: 5
      },
      this
    )
  ] }, void 0, true, {
    fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/richText/baseEditor/BlockElement.tsx",
    lineNumber: 26,
    columnNumber: 3
  }, this);
});
export {
  BlockElement
};
//# sourceMappingURL=BlockElement.js.map
