jmadler / emoji-picker

Add a slick emoji selector to input fields and textareas on your website.
Other
1.31k stars 318 forks source link

jQuery on('keyup') didn't working #53

Closed RafaelPlantard closed 6 years ago

RafaelPlantard commented 7 years ago

After using data-emoji-input="unicode" data-emojiable="true" all keyup binding data stop to working. Just working with change event.

mhetreramesh commented 6 years ago

I'm also facing the same issue? Does someone looking into it?

ThPadelis commented 6 years ago

I got the same problem too, but I can log out which key is pressed. My problem is that I can't submit the form on enter (e.which == 13).

Fabiombrs commented 6 years ago

ThPadelis Managed to solve?

ThPadelis commented 6 years ago

@Fabiombrs still can't figure out what's wrong...

Fabiombrs commented 6 years ago

@ThPadelis Did you test someone else? would have some to indicate? thankful !

Gexa commented 6 years ago

Hi, maybe this helps someone (it's solved my problem): from line 379 in emojiarea.js:

this.$editor.on("change keydown keyup resize scroll", function(e) {
      // ADD THESE LINES TO TRIGGER ENTER KEY ON ORIGINAL INPUT
      if (e.keyCode == 13 && e.type == 'keyup') {
        var ev = jQuery.Event("keyup");
        ev.which = 13;
        ev.keyCode = 13;
        $textarea.trigger(ev);
      // IT'S NEEDED IN MY CHAT APP TO CLEAR CONTENTEDITABLE DIV AFTER SENDING THE MESSAGE
        editorDiv.html('');
      }

      if(MAX_LENGTH_ALLOWED_KEYS.indexOf(e.which) == -1 &&
        !((e.ctrlKey || e.metaKey) && e.which == 65) && // Ctrl + A
        !((e.ctrlKey || e.metaKey) && e.which == 67) && // Ctrl + C
        editorDiv.text().length + editorDiv.find('img').length >= editorDiv.attr('maxlength'))
      {
        e.preventDefault();
      }
      self.updateBodyPadding(editorDiv);
});

Hope this helps. :)

leeadh commented 5 years ago

HI hi, this didnt work. I tried to use this and placed in jquery.emojiarea.js but no luck :(

jeffrywilson commented 4 years ago

After using data-emojiable="true" all keydown binding data stop to working. When I type the key 'enter', the messages must be submitted. However, after using emoji-picker, it doesn't work properly, Thanks in advance. Please help me.

jscouvert commented 2 years ago

Here is trhe solution. Use norealTime parameter (set to false) :

Like this :

new EmojiPicker({
                                emojiable_selector: ".hasEmojiPicker.picker_" + translatekey_field,
                                assetsPath: "/js/plugins/emoji-picker/img/",
                                popupButtonClasses: "fa fa-smile-o input-group-btn btn btn-default",
                                norealTime: false
                            });`