I am using CKEditor React Component (https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/react.html) at multiple times in my project. RichTextEditor.js (in folder A)
import React, { Component } from "react";
import { CKEditor } from "@ckeditor/ckeditor5-react";
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import "./RichTextEditor.css";
const RichTextEditor = () => {
return (
<div>
<CKEditor
editor={ClassicEditor}
data="<p>Enter your brand description here...</p>"
onReady={(editor) => {
// You can store the "editor" and use when it is needed.
console.log("Editor is ready to use!", editor);
}}
onChange={(event, editor) => {
const data = editor.getData();
console.log({ event, editor, data });
}}
onBlur={(event, editor) => {
console.log("Blur.", editor);
}}
onFocus={(event, editor) => {
console.log("Focus.", editor);
}}
/>
</div>
);
};
export default RichTextEditor;
I have used this component in folder A where I set the height of editor by creating CSS file and changed the default height as follows:
RichTextEditor.css (in folder A)
.ck-editor__editable {
min-height: 100px;
}
Now, I want to use the same component in folder A to folder B where height of component is different. But at the same time I want to use philosophy of React to reuse the component. But if I import component from folder A to folder B, I will also need to import the css file in folder A which will be of height 100px. But in folder B, I want different height. otherwise, I need to create different CSS file in folder B which I don't want to do.
The thing is I am using Material UI and I don't know how to edit this in built style properties in CKEditor with makeStyles in Material UI. Can anyone please tell me, how can I reuse the component and set the different heights in different components with Material UI??