2025-01-04 15:25:07 +00:00
|
|
|
// components/custom-editor.js
|
|
|
|
|
|
|
|
|
|
import React from "react";
|
|
|
|
|
import { CKEditor } from "@ckeditor/ckeditor5-react";
|
|
|
|
|
import Editor from "ckeditor5-custom-build";
|
|
|
|
|
|
|
|
|
|
function CustomEditor(props) {
|
|
|
|
|
return (
|
|
|
|
|
<CKEditor
|
|
|
|
|
editor={Editor}
|
|
|
|
|
data={props.initialData}
|
|
|
|
|
onChange={(event, editor) => {
|
|
|
|
|
const data = editor.getData();
|
|
|
|
|
console.log({ event, editor, data });
|
|
|
|
|
props.onChange(data);
|
|
|
|
|
}}
|
2025-01-05 00:12:17 +00:00
|
|
|
config={{
|
|
|
|
|
toolbar: [ 'heading', 'fontsize', 'bold', 'italic', 'link', 'numberedList', 'bulletedList', 'undo', 'redo', 'alignment', 'outdent', 'indent', 'blockQuote', 'insertTable', 'codeBlock', 'sourceEditing']
|
|
|
|
|
}}
|
2025-01-04 15:25:07 +00:00
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default CustomEditor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|