When I use this module I get this error “CKEditorError: ckeditor-duplicated-modules”
import React, { useState } from "react";
import { CKEditor } from "@ckeditor/ckeditor5-react";
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import CodeBlock from "@ckeditor/ckeditor5-code-block/src/codeblock";
interface EditorProps {
onChange: (newValue: string) => void;
value: string;
}
const Editor: React.FC<EditorProps> = ({ onChange, value }) => {
return (
<CKEditor
editor={ClassicEditor}
data={value}
config={{
plugins: [CodeBlock],
toolbar: ["codeBlock"],
}}
onChange={(event, editor) => {
const data = editor.getData();
onChange(data);
}}
/>
);
};
export default Editor;
Use CkEditor text editor with Code Block plugin
New contributor
sina soroosh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.