import { lazy, Suspense } from "react"; import InputText from "./InputText"; import clsx from "clsx"; import { useTranslation } from "react-i18next"; const NovelEditor = lazy(() => import("~/modules/novel/ui/editor")); interface Props { contentType: "wysiwyg" | "markdown"; value: string; onChangeValue: (e: string) => void; onChangeContentType?: (e: "wysiwyg" | "markdown") => void; name?: string; className?: string; editorLanguage?: string; editorTheme?: "vs-dark" | "light"; autoFocus?: boolean; disabled?: boolean; } export default function InputContent({ contentType, onChangeContentType, value, onChangeValue, name, className, editorLanguage = "markdown", editorTheme = "vs-dark", autoFocus = false, disabled = false, }: Props) { const { t } = useTranslation(); return (
{onChangeContentType && (
•
)} {contentType === "wysiwyg" ? (
{name && } onChangeValue(e.html ?? "")} usingLocalStorage={false} autoFocus={autoFocus} disabled={disabled} readOnly={disabled} />
) : contentType === "markdown" ? ( onChangeValue(e.toString())} autoFocus={autoFocus} disabled={disabled} readOnly={disabled} /> ) : null}
); }