codeslayer1 / react-ckeditor

CKEditor component for React with plugin and custom event listeners support
MIT License
130 stars 34 forks source link

Uncaught TypeError: c.split is not a function #71

Closed DamianFox closed 5 years ago

DamianFox commented 5 years ago

Hello. I'm trying to apply the Classic Editor with some Configuration in React:

import CKEditor from "react-ckeditor-component";
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';

import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';

const editorConfiguration = {
  plugins: [ Essentials, Bold, Italic, Paragraph ],
  toolbar: [ 'bold', 'italic' ]
};

<CKEditor 
         activeClass="ckeditor"
         content={this.state.editor_content}
         config={ editorConfiguration }
         editor={ ClassicEditor }
         name="description"
         events={{
              "blur": this.onBlur,
              "afterPaste": this.afterPaste,
              "change": this.onChange
          }}
/>

However, using the code above, the console is printing this message:

Uncaught TypeError: c.split is not a function
    at B (ckeditor.js:262)
    at ckeditor.js:261
    at ckeditor.js:491
    at CKEDITOR.resourceManager.<anonymous> (ckeditor.js:249)
    at f (ckeditor.js:244)
    at Array.B (ckeditor.js:244)
    at u (ckeditor.js:244)
    at ckeditor.js:245`, and the CKEditor is not displayed.

Am I doing something wrong?

codeslayer1 commented 5 years ago
const editorConfiguration = {
  plugins: [ Essentials, Bold, Italic, Paragraph ],
  toolbar: [ 'bold', 'italic' ]
};

It seems to me that you are missing quotes in plugins. Shouldn't your array be like this since you are using strings in array.

plugins: [ 'Essentials', 'Bold', 'Italic', 'Paragraph' ],

Edit I just saw after your edit that you are importing these plugins from CKEditor5. This package does not support CKEditor5 at the moment. Please check if any other react package exists with CKEditor5 support.