"use client";

import dynamic from "next/dynamic";
import type { ComponentType } from "react";
import type { DocumentEditorHostProps } from "@/components/editor/editor-host-types";

const LeptosTiptapIslandEditor = dynamic(
  () =>
    import("@/components/editor/leptos-tiptap-island-editor-host").then(
      (mod) => mod.LeptosTiptapIslandEditorHost,
    ),
  {
    ssr: false,
    loading: () => (
      <div className="flex h-64 items-center justify-center text-sm text-gray-400">编辑器加载中...</div>
    ),
  },
) as ComponentType<DocumentEditorHostProps>;

export function EditorHost(props: DocumentEditorHostProps) {
  return <LeptosTiptapIslandEditor {...props} />;
}
