Replace spoiler pattern
Do not render emoji as big if it's hidden Fix displaying start button in regular peers
This commit is contained in:
parent
5bb8dca8b4
commit
f8b414f03b
@ -2663,7 +2663,7 @@ export default class ChatBubbles {
|
||||
let strLength = messageMessage.length;
|
||||
let emojiStrLength = emojiEntities.reduce((acc, curr) => acc + curr.length, 0);
|
||||
|
||||
if(emojiStrLength === strLength && emojiEntities.length <= 3) {
|
||||
if(emojiStrLength === strLength && emojiEntities.length <= 3 && totalEntities.length === emojiEntities.length) {
|
||||
if(rootScope.settings.emoji.big) {
|
||||
let sticker = this.appStickersManager.getAnimatedEmojiSticker(messageMessage);
|
||||
if(emojiEntities.length === 1 && !messageMedia && sticker) {
|
||||
|
@ -413,7 +413,7 @@ export class AppImManager {
|
||||
domain: pathnameParams[0],
|
||||
post: pathnameParams[1],
|
||||
comment: uriParams.comment,
|
||||
start: 'start' in uriParams && uriParams.start
|
||||
start: 'start' in uriParams ? uriParams.start : undefined
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -774,8 +774,9 @@ namespace RichTextProcessor {
|
||||
case 'messageEntitySpoiler': {
|
||||
if(options.noTextFormat) {
|
||||
const before = text.slice(0, entity.offset);
|
||||
const spoilerBefore = text.slice(entity.offset, entity.offset + entity.length);
|
||||
const after = text.slice(entity.offset + entity.length);
|
||||
text = before + '▚'.repeat(entity.length) + after;
|
||||
text = before + spoiler(spoilerBefore)/* '▚'.repeat(entity.length) */ + after;
|
||||
} else if(options.wrappingDraft) {
|
||||
insertPart(entity, '<span style="font-family: spoiler;">', '</span>');
|
||||
} else {
|
||||
@ -887,6 +888,19 @@ namespace RichTextProcessor {
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
export function spoiler(text: string): string {
|
||||
const chars = '⠁⠂⠄⠈⠐⠠⡀⢀⠃⠅⠆⠉⠊⠌⠑⠒⠔⠘⠡⠢⠤⠨⠰⡁⡂⡄⡈⡐⡠⢁⢂⢄⢈⢐⢠⣀⠇⠋⠍⠎⠓⠕⠖⠙⠚⠜⠣⠥⠦⠩⠪⠬⠱⠲⠴⠸⡃⡅⡆⡉⡊⡌⡑⡒⡔⡘⡡⡢⡤⡨⡰⢃⢅⢆⢉⢊⢌⢑⢒⢔⢘⢡⢢⢤⢨⢰⣁⣂⣄⣈⣐⣠⠏⠗⠛⠝⠞⠧⠫⠭⠮⠳⠵⠶⠹⠺⠼⡇⡋⡍⡎⡓⡕⡖⡙⡚⡜⡣⡥⡦⡩⡪⡬⡱⡲⡴⡸⢇⢋⢍⢎⢓⢕⢖⢙⢚⢜⢣⢥⢦⢩⢪⢬⢱⢲⢴⢸⣃⣅⣆⣉⣊⣌⣑⣒⣔⣘⣡⣢⣤⣨⣰⠟⠯⠷⠻⠽⠾⡏⡗⡛⡝⡞⡧⡫⡭⡮⡳⡵⡶⡹⡺⡼⢏⢗⢛⢝⢞⢧⢫⢭⢮⢳⢵⢶⢹⢺⢼⣇⣋⣍⣎⣓⣕⣖⣙⣚⣜⣣⣥⣦⣩⣪⣬⣱⣲⣴⣸⠿⡟⡯⡷⡻⡽⡾⢟⢯⢷⢻⢽⢾⣏⣗⣛⣝⣞⣧⣫⣭⣮⣳⣵⣶⣹⣺⣼⡿⢿⣟⣯⣷⣻⣽⣾⣿';
|
||||
const charsLength = chars.length;
|
||||
|
||||
const out: string[] = [];
|
||||
for(let i = 0; i < text.length; ++i) {
|
||||
let char = text.charCodeAt(i);
|
||||
out.push(chars[char % charsLength]);
|
||||
}
|
||||
|
||||
return out.join('');
|
||||
}
|
||||
|
||||
/* export function replaceUrlEncodings(urlWithEncoded: string) {
|
||||
return urlWithEncoded.replace(/(%[A-Z\d]{2})+/g, (str) => {
|
||||
|
Loading…
Reference in New Issue
Block a user