Skip to content

Commit

Permalink
CHG: 处理 emoji 名称
Browse files Browse the repository at this point in the history
  • Loading branch information
RuochenLyu committed Nov 17, 2016
1 parent 2fa4f66 commit 09e6966
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simditor-emoji",
"version": "2.1.2",
"version": "2.1.3",
"homepage": "https://github.com/mycolorway/simditor-emoji",
"authors": [
"tinyfive <[email protected]>"
Expand Down
6 changes: 4 additions & 2 deletions lib/simditor-emoji.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ EmojiButton = (function(_super) {
}

EmojiButton.prototype.renderMenu = function() {
var $list, dir, html, name, opts, tpl, _i, _len, _ref;
var $list, dir, html, name, opts, src, tpl, _i, _len, _ref;
tpl = '<ul class="emoji-list">\n</ul>';
opts = $.extend({
imagePath: 'images/emoji/',
Expand All @@ -58,7 +58,9 @@ EmojiButton = (function(_super) {
_ref = opts.images;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
name = _ref[_i];
html += "<li data-name='" + name + "'><img src='" + dir + name + "' width='20' height='20' alt='" + name + "' /></li>";
src = "" + dir + name;
name = name.split('.')[0];
html += "<li data-name='" + name + "'><img src='" + src + "' width='20' height='20' alt='" + name + "' /></li>";
}
$list = $(tpl);
$list.html(html).appendTo(this.menuWrapper);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simditor-emoji",
"version": "2.1.2",
"version": "2.1.3",
"description": "simditor emoji plugin",
"main": "lib/simditor-emoji.js",
"repository": {
Expand Down
4 changes: 3 additions & 1 deletion src/simditor-emoji.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ class EmojiButton extends Simditor.Button
dir = opts.imagePath.replace(/\/$/, '') + '/'

for name in opts.images
html += "<li data-name='#{ name }'><img src='#{ dir }#{ name }' width='20' height='20' alt='#{ name }' /></li>"
src = "#{ dir }#{ name }"
name = name.split('.')[0]
html += "<li data-name='#{ name }'><img src='#{ src }' width='20' height='20' alt='#{ name }' /></li>"

$list= $(tpl)
$list.html(html).appendTo(@menuWrapper)
Expand Down

0 comments on commit 09e6966

Please sign in to comment.