|
|
@ -774,8 +774,9 @@ namespace RichTextProcessor { |
|
|
|
case 'messageEntitySpoiler': { |
|
|
|
case 'messageEntitySpoiler': { |
|
|
|
if(options.noTextFormat) { |
|
|
|
if(options.noTextFormat) { |
|
|
|
const before = text.slice(0, entity.offset); |
|
|
|
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); |
|
|
|
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) { |
|
|
|
} else if(options.wrappingDraft) { |
|
|
|
insertPart(entity, '<span style="font-family: spoiler;">', '</span>'); |
|
|
|
insertPart(entity, '<span style="font-family: spoiler;">', '</span>'); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -888,6 +889,19 @@ namespace RichTextProcessor { |
|
|
|
return url; |
|
|
|
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) { |
|
|
|
/* export function replaceUrlEncodings(urlWithEncoded: string) { |
|
|
|
return urlWithEncoded.replace(/(%[A-Z\d]{2})+/g, (str) => { |
|
|
|
return urlWithEncoded.replace(/(%[A-Z\d]{2})+/g, (str) => { |
|
|
|
try { |
|
|
|
try { |
|
|
|