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)

emoticons.zip (2.0 KB) - added by Jakub Ś 13 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 13 years ago by Jakub Ś

Status: newpending

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:

config.smiley_path= CKEDITOR.basePath+'images/emoticons/';

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 use proposed setting and see if they work?

Last edited 13 years ago by Jakub Ś (previous) (diff)

comment:2 Changed 13 years ago by no_barcode

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 Jakub Ś

Status: pendingconfirmed
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:

  1. 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=[':)',':(',';)'];
    
  2. unpack folder from attachment and put it in ckeditorInstalationFolder/images
  3. Go to bbcode sample and comment out smiley settings
  4. Open bbcode sample in browser
  5. 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 Jakub Ś

Attachment: emoticons.zip added

comment:4 Changed 13 years ago by Jakub Ś

#8591 was marked as duplicate

comment:5 Changed 13 years ago by 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

Last edited 13 years ago by cke_aardbei (previous) (diff)

comment:6 in reply to:  5 Changed 12 years ago by Almog Baku

+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

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy