Gambar tidak tersedia
-0
SHARES
@@ -338,13 +359,13 @@ export default function DetailContent() {- {/* - Mikulnews.com - - */} - - {articleDetail?.description} -
+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
++ TinyMCE Editor (200KB bundle) +
+ {/*TinyMCE Editor Component
++ CKEditor5 Classic (800KB bundle) +
+ {/*CKEditor5 Classic Component
++ React Quill (100KB bundle) +
+ {/*React Quill Component
+Preview
+ +Current Content:
+ +Saved Content:
+ +Raw HTML:
+
+ {content}
+
+ Performance Benefits:
+-
+
- • 90% smaller bundle size compared to custom CKEditor5 +
- • Faster initial load time +
- • Better mobile performance +
- • Reduced memory usage +
- • Improved Lighthouse score +
Updated content at ${new Date().toLocaleTimeString()}
This content was set via setValue
`; + setValue('description', newContent); + setTestData(newContent); + }; + + const handleSetEmpty = () => { + setValue('description', ''); + setTestData(''); + }; + + const handleSetHTML = () => { + const htmlContent = ` +HTML Content Test
+This is a bold paragraph with italic text.
+-
+
- List item 1 +
- List item 2 +
- List item 3 +
Updated at: ${new Date().toLocaleTimeString()}
+ `; + setValue('description', htmlContent); + setTestData(htmlContent); + }; + + const onSubmit = (data: any) => { + console.log('Form submitted:', data); + alert('Form submitted! Check console for data.'); + }; + + return ( +Editor Test Component
+ +{JSON.stringify(watchedValues, null, 2)}
+ Instructions:
+-
+
- Switch between CustomEditor and FormEditor to test both +
- Click "Set Value" to test setValue functionality +
- Click "Set Empty" to test empty content handling +
- Click "Set HTML Content" to test rich HTML content +
- Type in the editor to test onChange functionality +
- Submit the form to see all data +
Tags
- {/*{errors.description?.message}
+ )} */} +{errors.description.message}
)} -File Media
{!isDetail && (Text
@@ -246,9 +268,16 @@ export default function GenerateContentRewriteForm(props: { content: (data: DiseRequired
} + {mainKeyword == "" && ( +Required
+ )} {articleIds.length < 3 && ( -Main Keyword
Title
Additional Keyword
- {article.categories?.[0]?.title || - article.categoryName || - "BERITA"} -
-{article.title}
-- {article.description} -
-- By {article.createdByName} —{" "} - {new Date(article.createdAt).toLocaleDateString("en-US", { - month: "long", - day: "numeric", - year: "numeric", - })} -
- - READ MORE > + ++ {article.categories?.[0]?.title || + article.categoryName || + "BERITA"} +
+{article.title}
++ {article.description} +
++ By {article.createdByName} —{" "} + {new Date(article.createdAt).toLocaleDateString("en-US", { + month: "long", + day: "numeric", + year: "numeric", + })} +
+ + READ MORE > +Recent Posts
{recentPosts.map((post, index) => ( -- {post.categories?.[0]?.title || - post.categoryName || - "BERITA"} -
-- {post.title} -
-- {new Date(post.createdAt).toLocaleDateString("en-US", { - month: "long", - day: "numeric", - year: "numeric", - })} -
-+ {post.categories?.[0]?.title || + post.categoryName || + "BERITA"} +
++ {post.title} +
++ {new Date(post.createdAt).toLocaleDateString("en-US", { + month: "long", + day: "numeric", + year: "numeric", + })} +
+- {article.categories?.[0]?.title || - article.categoryName || - "BERITA"} -
-{article.title}
-- {article.description} -
-- By {article.createdByName} —{" "} - {new Date(article.createdAt).toLocaleDateString("en-US", { - month: "long", - day: "numeric", - year: "numeric", - })} -
- - READ MORE > + ++ {article.categories?.[0]?.title || + article.categoryName || + "BERITA"} +
+{article.title}
++ {article.description} +
++ By {article.createdByName} —{" "} + {new Date(article.createdAt).toLocaleDateString("en-US", { + month: "long", + day: "numeric", + year: "numeric", + })} +
+ + READ MORE > +Recent Posts
{recentPosts.map((post, index) => ( -- {post.categories?.[0]?.title || - post.categoryName || - "BERITA"} -
-- {post.title} -
-- {new Date(post.createdAt).toLocaleDateString("en-US", { - month: "long", - day: "numeric", - year: "numeric", - })} -
-+ {post.categories?.[0]?.title || + post.categoryName || + "BERITA"} +
++ {post.title} +
++ {new Date(post.createdAt).toLocaleDateString("en-US", { + month: "long", + day: "numeric", + year: "numeric", + })} +
+- {article.categories?.[0]?.title || - article.categoryName || - "BERITA"} -
-{article.title}
-- {article.description} -
-- By {article.createdByName} —{" "} - {new Date(article.createdAt).toLocaleDateString("en-US", { - month: "long", - day: "numeric", - year: "numeric", - })} -
- - READ MORE > + ++ {article.categories?.[0]?.title || + article.categoryName || + "BERITA"} +
+{article.title}
++ {article.description} +
++ By {article.createdByName} —{" "} + {new Date(article.createdAt).toLocaleDateString("en-US", { + month: "long", + day: "numeric", + year: "numeric", + })} +
+ + READ MORE > +Recent Posts
{recentPosts.map((post, index) => ( -- {post.categories?.[0]?.title || - post.categoryName || - "BERITA"} -
-- {post.title} -
-- {new Date(post.createdAt).toLocaleDateString("en-US", { - month: "long", - day: "numeric", - year: "numeric", - })} -
-+ {post.categories?.[0]?.title || + post.categoryName || + "BERITA"} +
++ {post.title} +
++ {new Date(post.createdAt).toLocaleDateString("en-US", { + month: "long", + day: "numeric", + year: "numeric", + })} +
+- {article.categories?.[0]?.title || - article.categoryName || - "BERITA"} -
-{article.title}
-- {article.description} -
-- By {article.createdByName} —{" "} - {new Date(article.createdAt).toLocaleDateString("en-US", { - month: "long", - day: "numeric", - year: "numeric", - })} -
- - READ MORE > + ++ {article.categories?.[0]?.title || + article.categoryName || + "BERITA"} +
+{article.title}
++ {article.description} +
++ By {article.createdByName} —{" "} + {new Date(article.createdAt).toLocaleDateString("en-US", { + month: "long", + day: "numeric", + year: "numeric", + })} +
+ + READ MORE > +Recent Posts
{recentPosts.map((post, index) => ( -- {post.categories?.[0]?.title || - post.categoryName || - "BERITA"} -
-- {post.title} -
-- {new Date(post.createdAt).toLocaleDateString("en-US", { - month: "long", - day: "numeric", - year: "numeric", - })} -
-+ {post.categories?.[0]?.title || + post.categoryName || + "BERITA"} +
++ {post.title} +
++ {new Date(post.createdAt).toLocaleDateString("en-US", { + month: "long", + day: "numeric", + year: "numeric", + })} +
+- {article.categories?.[0]?.title || - article.categoryName || - "BERITA"} -
-{article.title}
-- {article.description} -
-- By {article.createdByName} —{" "} - {new Date(article.createdAt).toLocaleDateString("en-US", { - month: "long", - day: "numeric", - year: "numeric", - })} -
- - READ MORE > + ++ {article.categories?.[0]?.title || + article.categoryName || + "BERITA"} +
+{article.title}
++ {article.description} +
++ By {article.createdByName} —{" "} + {new Date(article.createdAt).toLocaleDateString("en-US", { + month: "long", + day: "numeric", + year: "numeric", + })} +
+ + READ MORE > +Recent Posts
{recentPosts.map((post, index) => ( -- {post.categories?.[0]?.title || - post.categoryName || - "BERITA"} -
-- {post.title} -
-- {new Date(post.createdAt).toLocaleDateString("en-US", { - month: "long", - day: "numeric", - year: "numeric", - })} -
-+ {post.categories?.[0]?.title || + post.categoryName || + "BERITA"} +
++ {post.title} +
++ {new Date(post.createdAt).toLocaleDateString("en-US", { + month: "long", + day: "numeric", + year: "numeric", + })} +
+