"use client";

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

export default function RichTextEditor({ value, onChange, placeholder }) {
    return (
        <CKEditor
            editor={ClassicEditor}
            data={value || ""}
            config={{
                licenseKey: "GPL",
                placeholder: placeholder || "Notes",
            }}
            onReady={(editor) => {
                editor.ui.view.editable.element.style.minHeight = "150px";
            }}
            onChange={(event, editor) => {
                onChange(editor.getData());
            }}
        />
    );
}