2025-07-21 08:12:11 +00:00
|
|
|
// components/custom-editor.js
|
2025-01-04 15:25:07 +00:00
|
|
|
|
2025-07-21 08:12:11 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import { CKEditor } from "@ckeditor/ckeditor5-react";
|
|
|
|
|
import Editor from "ckeditor5-custom-build";
|
2025-07-04 19:42:42 +00:00
|
|
|
|
2025-07-21 08:12:11 +00:00
|
|
|
function CustomEditor(props) {
|
2025-01-04 15:25:07 +00:00
|
|
|
return (
|
2025-07-21 08:12:11 +00:00
|
|
|
<CKEditor
|
|
|
|
|
editor={Editor}
|
|
|
|
|
data={props.initialData}
|
|
|
|
|
onChange={(event, editor) => {
|
|
|
|
|
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",
|
2025-07-04 19:42:42 +00:00
|
|
|
],
|
2025-01-05 00:12:17 +00:00
|
|
|
}}
|
2025-01-04 15:25:07 +00:00
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default CustomEditor;
|