Skip to content

Commit

Permalink
Make spoiler not unicode based
Browse files Browse the repository at this point in the history
  • Loading branch information
yzqzss committed Jun 16, 2024
1 parent 0f64184 commit 5c19c13
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/lib/richTextProcessor/spoiler.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
export default function spoiler(text: string): string {
const chars = '⠁⠂⠄⠈⠐⠠⡀⢀⠃⠅⠆⠉⠊⠌⠑⠒⠔⠘⠡⠢⠤⠨⠰⡁⡂⡄⡈⡐⡠⢁⢂⢄⢈⢐⢠⣀⠇⠋⠍⠎⠓⠕⠖⠙⠚⠜⠣⠥⠦⠩⠪⠬⠱⠲⠴⠸⡃⡅⡆⡉⡊⡌⡑⡒⡔⡘⡡⡢⡤⡨⡰⢃⢅⢆⢉⢊⢌⢑⢒⢔⢘⢡⢢⢤⢨⢰⣁⣂⣄⣈⣐⣠⠏⠗⠛⠝⠞⠧⠫⠭⠮⠳⠵⠶⠹⠺⠼⡇⡋⡍⡎⡓⡕⡖⡙⡚⡜⡣⡥⡦⡩⡪⡬⡱⡲⡴⡸⢇⢋⢍⢎⢓⢕⢖⢙⢚⢜⢣⢥⢦⢩⢪⢬⢱⢲⢴⢸⣃⣅⣆⣉⣊⣌⣑⣒⣔⣘⣡⣢⣤⣨⣰⠟⠯⠷⠻⠽⠾⡏⡗⡛⡝⡞⡧⡫⡭⡮⡳⡵⡶⡹⡺⡼⢏⢗⢛⢝⢞⢧⢫⢭⢮⢳⢵⢶⢹⢺⢼⣇⣋⣍⣎⣓⣕⣖⣙⣚⣜⣣⣥⣦⣩⣪⣬⣱⣲⣴⣸⠿⡟⡯⡷⡻⡽⡾⢟⢯⢷⢻⢽⢾⣏⣗⣛⣝⣞⣧⣫⣭⣮⣳⣵⣶⣹⣺⣼⡿⢿⣟⣯⣷⣻⣽⣾⣿';
const chars = '⡚⡎⢪⡁⢘⢒⣁⣂⡙⣪⣬⡩⣐⣇⣼⣤⡇⡖⠖⢈⠌⠼⡗⢓⠥⡛⡽⢛⡍⣹⠆⠪⠛⠕⠝⡦⢙⡬⣆⣛⣜⣭';
const charsLength = chars.length;

const out: string[] = [];
for(let i = 0; i < text.length; ++i) {
const char = text.charCodeAt(i);
out.push(chars[char % charsLength]);
out.push(chars[i % charsLength]);
}

return out.join('');
Expand Down

0 comments on commit 5c19c13

Please sign in to comment.