"use client";

import React from "react";
import { KnowledgeEditor } from "./KnowledgeEditor";

interface EntryEditorProps {
  content: string;
  onChange: (content: string) => void;
}

/**
 * EntryEditor - WYSIWYG editor for knowledge entries.
 * Wraps KnowledgeEditor (Tiptap) with markdown round-trip.
 * Content is stored as markdown; the editor provides rich text editing.
 */
export function EntryEditor({ content, onChange }: EntryEditorProps): React.JSX.Element {
  return (
    <div className="entry-editor">
      <label className="block text-sm font-medium mb-2" style={{ color: "var(--text-2)" }}>
        Content
      </label>
      <KnowledgeEditor
        content={content}
        onChange={onChange}
        placeholder="Write your content here... Supports markdown formatting."
      />
    </div>
  );
}
