CkEditor: Uncaught TypeError: Cannot read property 'indexOf' from undefined
I am having a problem with CKEditor. When I use the BBCode plugin and enter a basic emoticon (ex: ": D" or ":(" as the first image) then the error "Uncaught TypeError: Cannot read property" indexOf "from undefined" appears in the console log and the editor becomes blank, looks like the third image.
Although I have inserted "config.extraPlugins = 'smiley';" in config.js the error will still happen.
First image, I insert a smiley face.
Then I click the Source button in the second image.
And again click the "Source" button in the third image, this is an error.
Image 1: http://i.stack.imgur.com/nNbCY.jpg
Image 2: Miss
3rd image: http://i.stack.imgur.com/UUNfZ.jpg
And here is my code
In config.js:
CKEDITOR.editorConfig = function( config ) {
config.extraPlugins = 'smiley';
config.language = 'vi';
config.uiColor = '#eeeeee'; config.height = 300;
};
source to share
First of all, you misconfigured the editor. You install config.extraPlugins
separately in two places, and as a result you overwrite the first setting (from config.js
) with your config on page (s CKEDITOR.replace
) instead of extending . You can read more about ordering a configuration download here .
The screenshot shows that there is no emoji button in the toolbar, which means that this feature is not enabled at all.
Note that it config.extraPlugins
accepts a list of all additional plugins you want to include, so if you want to use like bbcode
and smiley
, your config must include them in a single declaration:
config.extraPlugins = 'bbcode,smiley';
Also, see the BBCode Editing Example from the CKEditor SDK for an example of how you can customize CKEditor to output BBCode as well as customize emoticons. Scroll down to "Get Sample Source" for the complete working code used to create the sample. Also check the additional documentation for BBCode editing .
source to share