import React, { useContext } from "react";
import { NodeViewContent } from "./../../tiptap/index.js";
import { RicosTiptapContext } from "../context.js";
import styles from "../statics/styles/tiptap-editor-styles-scss.js";
import { ErrorBoundary } from "./error-boundary.js";
const RicosNode = ({ Component, tiptapNodeProps }) => {
  const ricosTiptapContext = useContext(RicosTiptapContext) || {};
  const componentProps = {
    ...ricosTiptapContext,
    // helpers, editor Props
    componentData: tiptapNodeProps.node.attrs,
    ...tiptapNodeProps,
    NodeViewContent
  };
  if (!ricosTiptapContext.context.t) {
    return null;
  }
  return /* @__PURE__ */ React.createElement(
    "div",
    {
      "data-hook": `ricos-node editor-${tiptapNodeProps.node.attrs.id}`,
      className: styles["ricos-node"]
    },
    /* @__PURE__ */ React.createElement(ErrorBoundary, { t: ricosTiptapContext.context.t }, /* @__PURE__ */ React.createElement(Component, { ...componentProps }))
  );
};
export {
  RicosNode
};
//# sourceMappingURL=ricos-node.js.map
