Reputation: 314
I had a problem with CKEditor. When I use plugin BBCode and input a basic smiley ( ex: ":D" or ":(" like the first image ) then the error "Uncaught TypeError: Cannot read property 'indexOf' of undefined" appears in console log, and the editor become empty looks like the third image.
Althought I had inserted "config.extraPlugins = 'smiley';" in config.js, the error still happen.
The first image, I input a smiley.
Then i click "Source" button in the second image.
And click "Source" button again in third image, this is error.
Image 1st: https://i.sstatic.net/nNbCY.jpg
Image 2nd: Miss
Image 3rd: https://i.sstatic.net/UUNfZ.jpg
And here is my code
CKEDITOR.replace( 'editor', { extraPlugins : 'bbcode' });
In a config.js:
CKEDITOR.editorConfig = function( config ) {
config.extraPlugins = 'smiley';
config.language = 'vi';
config.uiColor = '#eeeeee'; config.height = 300;
};
Upvotes: 3
Views: 3249
Reputation: 2239
First of all, you are setting the editor configuration incorrectly. You are setting config.extraPlugins
separately in two places and as a result, you are overwriting the first setting (from config.js
) with your in-page configuration (set in CKEDITOR.replace
) instead of extending it. You can read more about configuration loading order here.
Your screenshot shows that there is no smiley button in the toolbar which means that this functionality is not enabled at all.
Note that config.extraPlugins
accepts a list of all additional plugins that you want to enable, so if you want to use both bbcode
and smiley
, your configuration should include them in one declaration:
config.extraPlugins = 'bbcode,smiley';
Additionally, see the BBCode Editing sample from CKEditor SDK for an example of how you can configure CKEditor to output BBCode, and also configure smilies. Scroll down to "Get Sample Source Code" to get the complete working code that is used to create the sample. Also check the documentation for BBCode editing for more information.
Upvotes: 4