emojionearea
Version:
WYSIWYG-like EmojiOne Converter / Picker Plugin for jQuery
25 lines • 791 B
JavaScript
define([
'var/emojione',
'function/unicodeTo'
],
function(emojione, unicodeTo) {
return function(str, self) {
str = str
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''')
.replace(/`/g, '`')
.replace(/(?:\r\n|\r|\n)/g, '\n')
.replace(/(\n+)/g, '<div>$1</div>')
.replace(/\n/g, '<br/>')
.replace(/<br\/><\/div>/g, '</div>');
if (self.shortnames) {
str = emojione.shortnameToUnicode(str);
}
return unicodeTo(str, self.emojiTemplate)
.replace(/\t/g, ' ')
.replace(/ /g, ' ');
}
});