import React from "react";
import { useEditor, EditorContent } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
import Placeholder from "@tiptap/extension-placeholder";
import {
Bold,
Italic,
List,
ListOrdered,
Heading2,
Quote,
Undo,
Redo,
} from "lucide-react";
import { Button } from "./ui/button";
const MenuBar = ({ editor }) => {
if (!editor) {
return null;
}
return (
);
};
const RichTextEditor = ({
content,
onChange,
placeholder = "Enter description...",
}) => {
const editor = useEditor({
extensions: [
StarterKit,
Placeholder.configure({
placeholder,
}),
],
content,
onUpdate: ({ editor }) => {
onChange(editor.getHTML());
},
});
return (
);
};
export default RichTextEditor;