diff --git a/app/js/lib/ng_utils.js b/app/js/lib/ng_utils.js
index 89ae3291..465d07f7 100644
--- a/app/js/lib/ng_utils.js
+++ b/app/js/lib/ng_utils.js
@@ -1373,6 +1373,14 @@ angular.module('izhukov.utils', [])
if (start >= cStart && start < cEnd ||
end > cStart && end <= cEnd) {
// console.log('bad', curEntity, newEntity);
+ if (fromApi &&
+ start >= cStart && end <= cEnd) {
+ if (newEntity.nested === undefined) {
+ newEntity.nested = [];
+ }
+ curEntity.offset -= cStart;
+ newEntity.nested.push(angular.copy(curEntity));
+ }
bad = true;
break;
}
@@ -1395,6 +1403,14 @@ angular.module('izhukov.utils', [])
return totalEntities;
}
+ function wrapRichNestedText (text, nested, options) {
+ if (nested === undefined) {
+ return encodeEntities(text);
+ }
+
+ return wrapRichText(text, {entities: nested, nested: true});
+ }
+
function wrapRichText (text, options) {
if (!text || !text.length) {
return '';
@@ -1518,7 +1534,7 @@ angular.module('izhukov.utils', [])
'',
- encodeEntities(entityText),
+ wrapRichNestedText(entityText, entity.nested, options),
''
);
break;
@@ -1567,7 +1583,7 @@ angular.module('izhukov.utils', [])
case 'messageEntityBold':
html.push(
'',
- encodeEntities(entityText),
+ wrapRichNestedText(entityText, entity.nested, options),
''
);
break;
@@ -1575,7 +1591,7 @@ angular.module('izhukov.utils', [])
case 'messageEntityItalic':
html.push(
'',
- encodeEntities(entityText),
+ wrapRichNestedText(entityText, entity.nested, options),
''
);
break;
@@ -1607,7 +1623,7 @@ angular.module('izhukov.utils', [])
text = $sanitize(html.join(''));
- if (emojiFound) {
+ if (emojiFound && !options.nested) {
text = text.replace(/\ufe0f|️|�|/g, '', text);
text = text.replace(//g,
'');