I am using SCEditor and I am trying to set my own custom emoticons according to the emoticons option specified on this page.
So I called it like so:
$(document).ready(function() {
$(".sceditor").sceditor({
// Other options
emoticons: $.getJSON('../../images/emoticons/default/emoticons.json'),
emoticonsRoot: '../../images/emoticons/default/'
});
})
Then in my emoticons.json
file I have this:
{
dropdown: {
':)': 'emoticons/smile.png',
':angel:': 'emoticons/angel.png',
':angry:': 'emoticons/angry.png'
}
}
However it is not working. I have checked the NET
panel in my browser and I have confirmed it is fetching the .json
file fine, however when I click to open the smiley window in the editor it is blank (all I see is the "more" link).
Am I doing something wrong here?
As per WhiteWater's answer the reason it wasn't working was because it was returning a
JQXHR
object and not aJSON
object, so I had to work out how to get it to return aJSON
object whilst the editor loading not being dependent on the emoticons existence.So we have the solution below with credit to jeremysawesome for his answer to this question:
This will load the emoticons but will always load the sceditor instance, even if the emoticons fail for some reason.