"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const ui = require("@contember/ui");
const react = require("react");
const slateReact = require("slate-react");
const reactI18n = require("@contember/react-i18n");
const index = require("../ContemberEditor/index.cjs");
const editorDictionary = require("./editorDictionary.cjs");
const BlockElement = react.memo(function BlockElement2({
  element,
  children,
  attributes,
  domElement = "div",
  withBoundaries = false
}) {
  const editor = slateReact.useSlateStatic();
  const dataAttributes = index.ContemberEditor.getElementDataAttributes(element);
  const El = domElement;
  const formatter = reactI18n.useMessageFormatter(editorDictionary.editorDictionary);
  return /* @__PURE__ */ jsxRuntime.jsxs(El, { ...dataAttributes, ...attributes, children: [
    withBoundaries && /* @__PURE__ */ jsxRuntime.jsx(
      ui.EditorBlockBoundary,
      {
        blockEdge: "before",
        newParagraphText: formatter("editorBlock.editorBlockBoundary.newParagraph"),
        onClick: () => {
          const elementPath = slateReact.ReactEditor.findPath(editor, element);
          editor.insertBetweenBlocks([element, elementPath], "before");
        }
      }
    ),
    children,
    withBoundaries && /* @__PURE__ */ jsxRuntime.jsx(
      ui.EditorBlockBoundary,
      {
        blockEdge: "after",
        newParagraphText: formatter("editorBlock.editorBlockBoundary.newParagraph"),
        onClick: () => {
          const elementPath = slateReact.ReactEditor.findPath(editor, element);
          editor.insertBetweenBlocks([element, elementPath], "after");
        }
      }
    )
  ] });
});
exports.BlockElement = BlockElement;
//# sourceMappingURL=BlockElement.cjs.map
