Skip to content

Commit be22585

Browse files
authored
Feature use twemoji (ruby-china#677)
* Twemoji 3.0, fix markdown parse. * Sort emojis in complete list. * Add 💩 to markdown example * CDN emoji image files. * Add favorite emoji. * Add Emoji pickup window. * Improve emoji modal render performance. * Emoji image withou zoom. * Save most used emojis.
1 parent a9ff07d commit be22585

File tree

16 files changed

+1348
-142
lines changed

16 files changed

+1348
-142
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ gem 'rack-attack'
2222
gem 'rails-i18n', '5.0.0.beta3'
2323
gem 'http_accept_language'
2424
gem 'rails_autolink'
25-
gem 'md_emoji'
25+
gem 'twemoji'
2626
gem 'jquery-atwho-rails'
2727

2828
# OAuth Provider

Gemfile.lock

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,6 @@ GEM
203203
nokogiri (>= 1.5.9)
204204
mail (2.6.4)
205205
mime-types (>= 1.16, < 4)
206-
md_emoji (1.0.2)
207-
railties (>= 3.1.0)
208-
redcarpet (>= 2.0)
209206
memory_profiler (0.9.6)
210207
method_source (0.8.2)
211208
mime-types (3.1)
@@ -408,6 +405,8 @@ GEM
408405
tool (0.2.3)
409406
turbolinks (2.5.3)
410407
coffee-rails
408+
twemoji (3.0.0)
409+
nokogiri (~> 1.6.2)
411410
tzinfo (1.2.2)
412411
thread_safe (~> 0.1)
413412
uglifier (3.0.0)
@@ -463,7 +462,6 @@ DEPENDENCIES
463462
kgio
464463
letter_avatar
465464
letter_opener
466-
md_emoji
467465
mini_magick
468466
nokogiri (>= 1.6.8)
469467
notifications
@@ -505,6 +503,7 @@ DEPENDENCIES
505503
sprockets
506504
status-page
507505
turbolinks (~> 2.5.3)
506+
twemoji
508507
uglifier
509508
will_paginate
510509

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ $ rails s
8484
bundle exec rake
8585
```
8686
87-
## About Emoji Asset files
88-
89-
You may see emoji files 404 not found, after you publish you app. Because the emoji not include into Assets Pipline, what reason you can read Issue #522.
90-
91-
You need upload emoji images into `/assets/emojis` production environment path / CDN path, you can find image here: [md_emoji](https://github.com/elm-city-craftworks/md_emoji/tree/master/vendor/assets/images/emojis)
92-
9387
## Contributors
9488
9589
* [Contributors](https://github.com/ruby-china/ruby-china/contributors)

app/assets/javascripts/app.coffee

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
#= require jquery.fluidbox.min
1515
#= require social-share-button
1616
#= require jquery.atwho
17-
#= require emoji_list
17+
#= require emoji-data
18+
#= require emoji-modal
1819
#= require notifier
1920
#= require action_cable
2021
#= require form_storage
@@ -248,6 +249,7 @@ window.App =
248249
current_user_id: null
249250
access_token : ''
250251
asset_url : ''
252+
twemoji_url: 'https://twemoji.maxcdn.com/'
251253
root_url : ''
252254
cable: ActionCable.createConsumer()
253255

@@ -302,9 +304,10 @@ window.App =
302304
insertTpl : "@${login}"
303305
.atwho
304306
at : ":"
307+
searchKey: 'code'
305308
data : window.EMOJI_LIST
306-
displayTpl : "<li data-value='${name}:'><img src='#{App.asset_url}/assets/emojis/${name}.png' height='20' width='20'/> ${name} </li>"
307-
insertTpl: ":${name}:"
309+
displayTpl : "<li data-value='${code}'><img src='#{App.twemoji_url}/svg/${url}.svg' class='twemoji' /> ${code} </li>"
310+
insertTpl: "${code}"
308311
true
309312

310313
$(document).on 'page:change', ->

0 commit comments

Comments
 (0)