Can't create multiple instances of ckeditor ("default" is already registered)

I have a page (using kendo-ui, if it matters) that has three text areas that need to be entered into the editors. The problem is that I can only create one instance of ckeditor. No matter how I try to create new instances, I get this error:

uncaught exception: [CKEDITOR.resourceManager.add] The resource name "default" is already registered.

      

Google for this error message only brings me one result which doesn't really tell me anything about it.

This is what I have tried so far after looking for various problems like My on Stack Overflow:

- Deleting instances of the editor if not used / hidden

var editor = CKEDITOR.instances['createText'];
if (editor) { editor.destroy(true); }
$('#editTemplate').ckeditor();

      

- creation of all copies in the finished document

    $('#createText').ckeditor();
    $('#editText').ckeditor();
    $('#editTemplate').ckeditor();

      

- using class names instead of jquery to instantiate

    <textarea id="editText" class="ckeditor"></textarea>

      

- don't use jquery and instantiate with

CKEDITOR.replace('createText');

      

No matter what I do, I cannot create more than one editor, I just get: "The resource name" default "is already registered." I even tried to manually remove default from resourceManager but no

CKEDITOR.resourceManager.remove

      

At this point, I completely rule out the ideas and nothing from the search seems to address this exact question. I am using ckeditor version 4.4.4

+3


source to share


2 answers


Thanks to skobaljic, I was able to determine where the problem came from. In my config.js I had this block:

CKEDITOR.stylesSet.add('default', [
// Block Styles
{ name: 'Subtitle', element: 'h3', styles: { 'color': '#aaa', 'font-style': 'italic' } },
// Object Styles
{ name: 'Small', element: 'font', attributes: { size: 3 } }
]);

      



comment that blocking editors works as expected. I think in order to add these styles to each instance of the editor, I'll have to use separate config files or something, but that is beyond the scope of this question.

+1


source


One thing I've found is that if you have a ckeditor class attached to a text area, it fails. So get out of class="ckeditor"

there.

This works: http://jsfiddle.net/qahohgrf/



This gives errors: http://jsfiddle.net/4rcgy7wa/

0


source







All Articles