Commit 972c31be authored by JC Brand's avatar JC Brand

emoji: Allow the option of using emojione (now that we sanitize)

parent 284e8847
......@@ -993,13 +993,13 @@ Notification will be shown in the following cases:
Requires the `src/converse-notification.js` plugin.
show_emojione
-------------
* Default: ``false``
use_emojione
------------
* Default: ``true``
Determines whether `Emojione <https://www.emojione.com/>`_ should be used to
render emojis. The default is not to do this, but to simply let the operating
system or browser render emoji (if it has support for them).
render emojis. If set to ``false``, then rendering support will fall back to
the operating system or browser (which might not support emoji).
show_only_online_users
----------------------
......
......@@ -412,6 +412,8 @@
}, 300).then(function () {
$toolbar.children('li.toggle-smiley').click();
expect(view.toggleEmojiMenu).toHaveBeenCalled();
view.$el.find('textarea.chat-textarea').trigger($.Event('keypress', {keyCode: 13}));
test_utils.waitUntil(function () {
var $picker = view.$el.find('.toggle-smiley .emoji-picker-container');
return $picker.is(':visible');
......
......@@ -92,6 +92,7 @@
{ __ } = _converse;
_converse.api.settings.update({
use_emojione: true,
chatview_avatar_height: 32,
chatview_avatar_width: 32,
show_toolbar: true,
......@@ -426,9 +427,7 @@
'extra_classes': this.getExtraMessageClasses(attrs)
})
));
if (_converse.visible_toolbar_buttons.emoji) {
text = utils.addEmoji(_converse, emojione, text);
}
text = utils.addEmoji(_converse, emojione, text);
const msg_content = $msg[0].querySelector('.chat-msg-content');
msg_content.innerHTML = xss.filterXSS(text, {'whiteList': {}});
utils.addHyperlinks(msg_content);
......
......@@ -599,7 +599,11 @@
};
utils.addEmoji = function (_converse, emojione, text) {
return emojione.shortnameToUnicode(text);
if (_converse.use_emojione) {
return emojione.toImage(text);
} else {
return emojione.shortnameToUnicode(text);
}
}
utils.marshallEmojis = function (emojione) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment