Reputation: 1
I have a react application with typescript enabled i.e. most of the files are .tsx . I initially added CK Editor basic / classic version and it worked fine. Now, as I need to use some premium features so I have been trying to integrate the CK Editor premium with my application. And boy, its been a nightmare. I downloaded the CKEditor react project from the website/ CK Editor Builder and that works fine. But when I try to use that code inside my own application. I just gets load of error.
To give you one example, if I add the code to my tsx file. I keep on getting the error on the config , i.e. the following line of code.
<div ref={editorRef}>{editorConfig && <CKEditor editor={ClassicEditor} config={editorConfig} />}</div> And this is the error Type '{ licenseKey?: undefined; toolbar?: undefined; plugins?: undefined; cloudServices?: undefined; collaboration?: undefined; trackChanges?: undefined; comments?: undefined; sidebar?: undefined; revisionHistory?: undefined; } | { ...; }' is not assignable to type 'EditorConfig | undefined'. Type '{ licenseKey: string; toolbar: { items: string[]; shouldNotGroupWhenFull: boolean; }; plugins: (typeof Essentials | typeof Autoformat | typeof Bold | typeof Italic | typeof Underline | ... 19 more ... | typeof RealTimeCollaborativeComments)[]; ... 5 more ...; revisionHistory: { ...; }; }' is not assignable to type 'EditorConfig'. The types of 'sidebar.container' are incompatible between these types. Type 'HTMLDivElement | null' is not assignable to type 'HTMLElement | undefined'. Type 'null' is not assignable to type 'HTMLElement | undefined'.ts(2322)
And if I convert it to a JSX file as the original code that CKEditor builder provided is in JSX format. It doesn't give me any error but it fails on License key. i.e. the same license key that working fine for the project given by CKEditor , its failing on the other project. I would really appreciate any sort of help as I have tried a lot of variations and nothing seemed to have worked .
I tried installing and re installing ck editor packages and different imports for it. Nothing seemed to have worked.
Upvotes: 0
Views: 34