Opened 13 years ago
Last modified 12 years ago
#8198 confirmed Bug
custom smileys in config.js causing errors?
Reported by: | no_barcode | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | 3.6 |
Keywords: | Cc: |
Description
I added the following to my config.js file:
config.smiley_path='/images/emoticons/'; config.smiley_images=['smiley.gif','teeth.gif','greed.gif','laugh.gif','wink.gif']; config.smiley_descriptions=[':)',':D','$$-)',':lol:',';)'];
Everything shows up correctly in the Insert a Smiley dialog box, and when I click one the image is inserted, but if I click to view "Source" or try to submit the form I get the following error:
TypeError: Result of expression 'C' [undefined] is not an object.
I've tried it on Safari and Firefox using the nightly build, and it does the same thing.
Attachments (1)
Change History (7)
comment:2 Changed 13 years ago by
It still gives me an error. However, since you were not getting an error I looked more closely at what could possibly be different in my case, and I realized that I forgot to mention that I am using the bbcode plugin. When I disable it, I don't get any errors with custom smileys. Maybe the bbcode plugin is the problem?
comment:3 Changed 13 years ago by
Status: | pending → confirmed |
---|---|
Version: | 3.6.2 (SVN - trunk) → 3.6 |
@no_barcode yes you are right this “insignificant” detail changes everything :)
In bbcode sample page it is written “Smiley images, for example, were stripped to the emoticons that are commonly used in some BBCode dialects”. The problem is that even if I use those commonly used icons and only change smiley path the JS error occurs.
Steps to reproduce:
- In your config.js set:
config.smiley_path= CKEDITOR.basePath+'images/emoticons/'; config.smiley_images=['regular_smile.gif','sad_smile.gif','wink_smile.gif']; config.smiley_descriptions=[':)',':(',';)'];
- unpack folder from attachment and put it in ckeditorInstalationFolder/images
- Go to bbcode sample and comment out smiley settings
- Open bbcode sample in browser
- Insert smiley and switch to source
Result: JS error pops out
Message: text is undefined
Line: 167
URI: /3.6.1/ckeditor/_source/plugins/entities/plugin.js
Reproducible from CKEditor 3.6 [6904]
Changed 13 years ago by
Attachment: | emoticons.zip added |
---|
comment:5 follow-up: 6 Changed 13 years ago by
Apologies - I already posted this for ticket #8591 before realising it was marked as a duplicate for this ticket.
I also found the same issue when I added CKE to phpBB. I took a look at the BBcode plugin code (plugins\bbcode\plugin.js) and found that some RegExp special chars are not being escaped when the SmileyRexExp is built on line 94. I changed it to:
smileyRegExp.push( smileyMap[ i ].replace( /\(|\)|\:|\/|\?|\+|\$|\.|\^|\*|\-|\|/g, function( match ) { return '\\' + match; } ));
Small update - I have added a check that smiley_map has some content before it can be used.
I also added an extra config field (config.smiley_map) so that a custom smileyMap could be used which supports custom smileys. With the extra field I then changed line 86 to:
var smileyMap = (CKEDITOR.config.smiley_map&&CKEDITOR.config.smiley_map.length)||{"smiley":":)","sad":":(","wink":";)","laugh":":D","cheeky":":P","blush":":*)","surprise":":-o","indecision":":|","angry":">:(","angel":"o:)","cool":"8-)","devil":">:-)","crying":";(","kiss":":-*" },
This swaps the standard smileyMap for a custom map if one is defined.
I hope this helps someone out.
Cheers, Laurie
comment:6 Changed 12 years ago by
+1 for this patch! option to change the smiley map is really important. Replying to cke_aardbei:
Apologies - I already posted this for ticket #8591 before realising it was marked as a duplicate for this ticket.
I also found the same issue when I added CKE to phpBB. I took a look at the BBcode plugin code (plugins\bbcode\plugin.js) and found that some RegExp special chars are not being escaped when the SmileyRexExp is built on line 94. I changed it to:
smileyRegExp.push( smileyMap[ i ].replace( /\(|\)|\:|\/|\?|\+|\$|\.|\^|\*|\-|\|/g, function( match ) { return '\\' + match; } ));Small update - I have added a check that smiley_map has some content before it can be used.
I also added an extra config field (config.smiley_map) so that a custom smileyMap could be used which supports custom smileys. With the extra field I then changed line 86 to:
var smileyMap = (CKEDITOR.config.smiley_map&&CKEDITOR.config.smiley_map.length)||{"smiley":":)","sad":":(","wink":";)","laugh":":D","cheeky":":P","blush":":*)","surprise":":-o","indecision":":|","angry":">:(","angel":"o:)","cool":"8-)","devil":">:-)","crying":";(","kiss":":-*" },This swaps the standard smileyMap for a custom map if one is defined.
I hope this helps someone out.
Cheers, Laurie
I think that there is an error in our docs because it shows that relative path can be used what is not true.
Your smiley path should look like:
It means that in ckeditor installation folder should be images/emoticons folders in which images will be looked for.
Any way I have tried to set your path but I did not get any JS errors, only missing icons.
Could you try to used proposed setting and see if they work?
Could you try to used proposed setting and see if they work?