Emoji smilies really sucks
See original GitHub issueI use the emoji plugins like mentioned in the plugin with Thumbowyg: https://github.com/Ranks/emojify.js
function opensmiley()
{
('#write_blog').trumbowyg({
btns: [['bold', 'italic','h2'], ['link'],['emoji'] ],
autogrow: true,
semantic: false,
removeformatPasted: true,
plugins: {
emoji: {
emojiList: [
[':+1:',HTML_ROOT+'images/smiley/small/+1.png'],
[':-1:',HTML_ROOT+'images/smiley/small/-1.png'],
[':airplane:',HTML_ROOT+'images/smiley/small/airplane.png'],
[':angry:',HTML_ROOT+'images/smiley/small/angry.png']
]
}
}
});
}
opensmiley();
Well it works, but not loaded every time. I need to reload all the time.
so this emoji button:
<button type="button" class="trumbowyg-emoji-button trumbowyg-open-dropdown trumbowyg-active" title="Add an emoji" tabindex="-1"><svg><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#trumbowyg-emoji"></use></svg></button>
Is not always present.
I have made an interval to check if the icon exists:
` var replai = setInterval(function() { if ($(‘.trumbowyg-button-pane div:nth-child(3)’).children().hasClass(‘trumbowyg-emoji-button’)) {
// content.next().children().prepend('<a href="'+delink+'" class="tag reply-to" type="button" data-role="none" target="_blank" title="Go to profile">@'+naamm+' </a>');
clearInterval(replai);
} else {
var button = '<button type="button" class="trumbowyg-emoji-button trumbowyg-open-dropdown trumbowyg-active" title="Add an emoji" tabindex="-1"><svg><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#trumbowyg-emoji"></use></svg></button>';
// creates the smiley button $(‘.trumbowyg-button-pane div:nth-child(3)’).html(button);
console.log('not good');
opensmiley(); doesnt reload
clearInterval(replai);
}
}, 100); // check every 100ms
`
the console log gives “no good” when the class is not present. it created the smiley button, but no click event works anymore.
Very annoying, does anyone knows how to fix it?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7
Good to know that is not really sucks 👍
Hi, emoji img tags are copied to textarea and it probably should not. It should be distributed like img tags -> $ed for preview while raw emoji keys -> $ta. Can you describe some approach how to do that? I am trying to implement https://github.com/twitter/twemoji. I can insert only text and parse whole content everytime, but it contrasts with current solution. Thank you
P.S. I think, simplest solution would be emoji key within img tag attrs and method that replaces all img tags of class “emoji” with this key while syncing to textarea