"use client";
import { CKEditor } from "@ckeditor/ckeditor5-react";
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";

interface Props {
  value?: string;
  onChange?: (data: string) => void;
}

export default function CommonCkEditor({ value, onChange }: Props) {
  return (
    <div className="editor-container">
      <CKEditor
        // @ts-expect-error – type mismatch not breaking runtime
        editor={ClassicEditor}
        data={value ?? ""}
        onChange={(_event: any, editor: any) => {
          onChange?.(editor.getData());
        }}
      />
    </div>
  );
}
