如何使用文本字段添加表情符号选择器

时间:2017-01-09 05:15:53

标签: javascript jquery ruby-on-rails emoji picker

我正在研究Rails项目。我必须添加一个表情符号选择器。我正在使用此库emoji picker

我的application.erb.html是

    <p class="modal-content">
      <%= simple_form_for current_user, locals:{ controller: :dashboards ,action: :update } do |f| %>
      <p class="emoji-picker-container">
      <%= f.text_field :mood, data: { emojiable: true }, maxlength: 3, required: 'required', disabled: 'disabled' %>
      <%= f.hidden_field :mood_date, value: DateTime.now.to_date  %>
     </p>                  

     <%= f.button  :submit , value: t('button.submit') %>
     <% end %>
   </p>

内联脚本:

<script>
      $(function() {
          // Initializes and creates emoji set from sprite sheet
          window.emojiPicker = new EmojiPicker({
              emojiable_selector: '[data-emojiable=true]',
              assetsPath: 'http://onesignal.github.io/emoji-picker/lib/img/',
              popupButtonClasses: 'fa fa-smile-o'
          });

          window.emojiPicker.discover();
      });
</script>

输出如下: enter image description here

但是问题在这里,我希望没有流行音乐会出现,表情符号框会被修复如下:

enter image description here

0 个答案:

没有答案