"use client"; import React, { useState } from 'react'; // Import the optimized editor (choose one based on your migration) // import OptimizedEditor from './optimized-editor'; // TinyMCE // import OptimizedCKEditor from './optimized-ckeditor'; // CKEditor5 Classic // import MinimalEditor from './minimal-editor'; // React Quill interface EditorExampleProps { editorType?: 'tinymce' | 'ckeditor' | 'quill'; } const EditorExample: React.FC = ({ editorType = 'tinymce' }) => { const [content, setContent] = useState('

Hello, this is the editor content!

'); const [savedContent, setSavedContent] = useState(''); const handleContentChange = (newContent: string) => { setContent(newContent); }; const handleSave = () => { setSavedContent(content); // console.log('Content saved:', content); }; const handleReset = () => { setContent('

Content has been reset!

'); }; return (

Rich Text Editor Example

This is an optimized editor with {editorType} - much smaller bundle size and better performance!

{/* Editor Panel */}

Editor

{/* Choose your editor based on migration */} {editorType === 'tinymce' && (

TinyMCE Editor (200KB bundle)

{/* */}

TinyMCE Editor Component

)} {editorType === 'ckeditor' && (

CKEditor5 Classic (800KB bundle)

{/* */}

CKEditor5 Classic Component

)} {editorType === 'quill' && (

React Quill (100KB bundle)

{/* */}

React Quill Component

)}
{/* Preview Panel */}

Preview

Current Content:

{savedContent && (

Saved Content:

)}

Raw HTML:

              {content}
            
{/* Performance Info */}

Performance Benefits:

  • • 90% smaller bundle size compared to custom CKEditor5
  • • Faster initial load time
  • • Better mobile performance
  • • Reduced memory usage
  • • Improved Lighthouse score
); }; export default EditorExample;