samclarke / SCEditor

A lightweight HTML and BBCode WYSIWYG editor
http://www.sceditor.com/
Other
660 stars 188 forks source link

Seperate emoticons from the js file #71

Closed LiamDawe closed 11 years ago

LiamDawe commented 11 years ago

The JS file is quite hard to edit, is it possible for you in a future version to have it get the emoticon list from a small html file? That way it becomes thousands of times easier to edit and when you update SCE i wouldn't have to re-do my changes? It would make it more user friendly. Keep up the great work!!

samclarke commented 11 years ago

You can set the emoticons list via the constructor, e.g.:

$('textarea').sceditor({
    plugins: 'bbcode',
    style: "../src/jquery.sceditor.default.css",

    // Emoticons list
    emoticons: {
        dropdown: {
            ":)": "emoticons/smile.png",
            ":angel:": "emoticons/angel.png"
            // ect
        },
        more: {
            ":alien:": "emoticons/alien.png",
            ":blink:": "emoticons/blink.png",
            ":blush:": "emoticons/blush.png",
            ":cheerful:": "emoticons/cheerful.png",
            ":devil:": "emoticons/devil.png"
            // ect
        },
        hidden: {
            ":whistling:": "emoticons/whistling.png",
            ":love:": "emoticons/wub.png"
            // ect
        }
    }
});
timint commented 11 years ago

This is an example from my code how I exclude the emoticons without getting all the 404 icons not found.

$("textarea[name='description']").sceditor({
  "width": "auto",
  "max-height": "auto",
  "locale": "sv",
  "emoticons": false,
  "toolbar": "bold,italic,underline,strike,subscript,superscript|left,center,right,justify|font,size,color,removeformat|bulletlist,orderedlist,table|code,quote|horizontalrule,image,email,link,unlink|youtube,date,time|ltr,rtl|print,maximize,source"
});

I too personally would prefer if the emoticons was an optional plugin.