jmadler / emoji-picker

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

2 blanks divs are being automatically generated inside "emoji-wysiwyg-editor" div. #39

Open maneeshpatel opened 7 years ago

maneeshpatel commented 7 years ago

Hey, While typing anything in textbox,two blanks divs are being generated automatically inside "emoji-wysiwyg-editor" div. Even after $('.emoji-wysiwyg-editor').empty(); those blanks div are present.

image

Anyone is also facing same issue?

kapitansen commented 7 years ago

I have similar issue, but it's fixed for me by $('.emoji-wysiwyg-editor').empty();

clip2net_170630124151

phomlish commented 6 years ago

with version 1.1.5 they are no longer blank divs. They are now <div><br></div> And they no longer go away with $('.emoji-wysiwyg-editor').empty();

linktoahref commented 1 year ago

Related to on enter key press.

A workaround to have <br> being inserted instead of <div><br></div> is to update the change event of the emojiarea and capture the enter event.

if (e.which == 13) {
    e.preventDefault();
    document.execCommand('insertHTML', false, '<br>');
    return false;
}

Also, I found the removing the keyup and keydown event was helpful in inserting only one <br> tag.

this.$editor.on("change resize scroll", function(e) { ... }