Mercurial Hosting > sceditor
changeset 39:9f63c8f506d1
simplify emoticons
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 18 Aug 2022 22:00:55 -0600 |
parents | 2dfdaaac9482 |
children | eaecca025287 |
files | src/sceditor.js |
diffstat | 1 files changed, 39 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/src/sceditor.js Thu Aug 18 21:36:34 2022 -0600 +++ b/src/sceditor.js Thu Aug 18 22:00:55 2022 -0600 @@ -1314,6 +1314,8 @@ } } + let emoticonsRoot = baseUrl + 'emoticons/'; + /** * Default options for SCEditor * @type {Object} @@ -1417,43 +1419,43 @@ emoticonsRoot: baseUrl, emoticons: { dropdown: { - ':)': 'emoticons/smile.png', - ':angel:': 'emoticons/angel.png', - ':angry:': 'emoticons/angry.png', - '8-)': 'emoticons/cool.png', - ':\'(': 'emoticons/cwy.png', - ':ermm:': 'emoticons/ermm.png', - ':D': 'emoticons/grin.png', - '<3': 'emoticons/heart.png', - ':(': 'emoticons/sad.png', - ':O': 'emoticons/shocked.png', - ':P': 'emoticons/tongue.png', - ';)': 'emoticons/wink.png' + ':)': emoticonsRoot + 'smile.png', + ':angel:': emoticonsRoot + 'angel.png', + ':angry:': emoticonsRoot + 'angry.png', + '8-)': emoticonsRoot + 'cool.png', + ':\'(': emoticonsRoot + 'cwy.png', + ':ermm:': emoticonsRoot + 'ermm.png', + ':D': emoticonsRoot + 'grin.png', + '<3': emoticonsRoot + 'heart.png', + ':(': emoticonsRoot + 'sad.png', + ':O': emoticonsRoot + 'shocked.png', + ':P': emoticonsRoot + 'tongue.png', + ';)': emoticonsRoot + 'wink.png' }, more: { - ':alien:': 'emoticons/alien.png', - ':blink:': 'emoticons/blink.png', - ':blush:': 'emoticons/blush.png', - ':cheerful:': 'emoticons/cheerful.png', - ':devil:': 'emoticons/devil.png', - ':dizzy:': 'emoticons/dizzy.png', - ':getlost:': 'emoticons/getlost.png', - ':happy:': 'emoticons/happy.png', - ':kissing:': 'emoticons/kissing.png', - ':ninja:': 'emoticons/ninja.png', - ':pinch:': 'emoticons/pinch.png', - ':pouty:': 'emoticons/pouty.png', - ':sick:': 'emoticons/sick.png', - ':sideways:': 'emoticons/sideways.png', - ':silly:': 'emoticons/silly.png', - ':sleeping:': 'emoticons/sleeping.png', - ':unsure:': 'emoticons/unsure.png', - ':woot:': 'emoticons/w00t.png', - ':wassat:': 'emoticons/wassat.png' + ':alien:': emoticonsRoot + 'alien.png', + ':blink:': emoticonsRoot + 'blink.png', + ':blush:': emoticonsRoot + 'blush.png', + ':cheerful:': emoticonsRoot + 'cheerful.png', + ':devil:': emoticonsRoot + 'devil.png', + ':dizzy:': emoticonsRoot + 'dizzy.png', + ':getlost:': emoticonsRoot + 'getlost.png', + ':happy:': emoticonsRoot + 'happy.png', + ':kissing:': emoticonsRoot + 'kissing.png', + ':ninja:': emoticonsRoot + 'ninja.png', + ':pinch:': emoticonsRoot + 'pinch.png', + ':pouty:': emoticonsRoot + 'pouty.png', + ':sick:': emoticonsRoot + 'sick.png', + ':sideways:': emoticonsRoot + 'sideways.png', + ':silly:': emoticonsRoot + 'silly.png', + ':sleeping:': emoticonsRoot + 'sleeping.png', + ':unsure:': emoticonsRoot + 'unsure.png', + ':woot:': emoticonsRoot + 'w00t.png', + ':wassat:': emoticonsRoot + 'wassat.png' }, hidden: { - ':whistling:': 'emoticons/whistling.png', - ':love:': 'emoticons/wub.png' + ':whistling:': emoticonsRoot + 'whistling.png', + ':love:': emoticonsRoot + 'wub.png' } }, @@ -2579,7 +2581,6 @@ var createContent = function (includeMore) { var moreLink, opts = editor.opts, - emoticonsRoot = opts.emoticonsRoot || '', emoticonsCompat = opts.emoticonsCompat, content = createElement('div'), line = createElement('div'), @@ -2603,10 +2604,10 @@ each(emoticons, function (code, emoticon) { appendChild(line, createElement('img', { - src: emoticonsRoot + (emoticon.url || emoticon), + src: emoticon, 'data-sceditor-emoticon': code, alt: code, - title: emoticon.tooltip || code + title: code })); if (line.children.length >= perLine) { @@ -4949,7 +4950,6 @@ */ initEmoticons = function () { var emoticons = options.emoticons; - var root = options.emoticonsRoot || ''; if (emoticons) { allEmoticons = extend( @@ -4961,8 +4961,8 @@ allEmoticons[key] = _tmpl('emoticon', { key: key, // Prefix emoticon root to emoticon urls - url: root + (url.url || url), - tooltip: url.tooltip || key + url: url, + tooltip: key }); }); };