// components/custom-editor.js import React from "react"; import { CKEditor } from "@ckeditor/ckeditor5-react"; import Editor from "ckeditor5-custom-build"; function CustomEditor(props) { const maxHeight = props.maxHeight || 600; // Default max height 600px return (
{ const data = editor.getData(); console.log({ event, editor, data }); props.onChange(data); }} config={{ toolbar: [ "heading", "fontsize", "bold", "italic", "link", "numberedList", "bulletedList", "undo", "redo", "alignment", "outdent", "indent", "blockQuote", "insertTable", "codeBlock", "sourceEditing", ], // Add content styling configuration content_style: ` body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 14px; line-height: 1.6; color: #333; margin: 0; padding: 0; } p { margin: 0.5em 0; } h1, h2, h3, h4, h5, h6 { margin: 1em 0 0.5em 0; } ul, ol { margin: 0.5em 0; padding-left: 2em; } blockquote { margin: 1em 0; padding: 0.5em 1em; border-left: 4px solid #d1d5db; background-color: #f9fafb; } `, // Editor appearance settings height: props.height || 400, removePlugins: ['Title'], // Better mobile support mobile: { theme: 'silver' } }} />
); } export default CustomEditor;