parent
eef98d0cd9
commit
fd994fdd97
@ -1425,6 +1425,7 @@ angular.module('izhukov.utils', [])
|
||||
if (nested === undefined) {
|
||||
return encodeEntities(text);
|
||||
}
|
||||
options.hasNested = true;
|
||||
|
||||
return wrapRichText(text, {entities: nested, nested: true});
|
||||
}
|
||||
@ -1642,7 +1643,7 @@ angular.module('izhukov.utils', [])
|
||||
|
||||
text = $sanitize(html.join(''));
|
||||
|
||||
if (emojiFound && !options.nested) {
|
||||
if (!options.nested && (emojiFound || options.hasNested)) {
|
||||
text = text.replace(/\ufe0f|️|�|‍/g, '', text);
|
||||
text = text.replace(/<span class="emoji emoji-(\d)-(\d+)-(\d+)"(.+?)<\/span>/g,
|
||||
'<span class="emoji emoji-spritesheet-$1" style="background-position: -$2px -$3px;" $4</span>');
|
||||
|
@ -361,6 +361,11 @@ function templateUrl (tplName) {
|
||||
function encodeEntities(value) {
|
||||
return value.
|
||||
replace(/&/g, '&').
|
||||
replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, function (value) {
|
||||
var hi = value.charCodeAt(0);
|
||||
var low = value.charCodeAt(1);
|
||||
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
|
||||
}).
|
||||
replace(/([^\#-~| |!])/g, function (value) { // non-alphanumeric
|
||||
return '&#' + value.charCodeAt(0) + ';';
|
||||
}).
|
||||
|
Loading…
x
Reference in New Issue
Block a user