From 5c19c13e7b995fd03600d53c72825b738a9f985e Mon Sep 17 00:00:00 2001 From: yzqzss Date: Sun, 16 Jun 2024 16:37:08 +0800 Subject: [PATCH] Make spoiler not unicode based #328 --- src/lib/richTextProcessor/spoiler.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/richTextProcessor/spoiler.ts b/src/lib/richTextProcessor/spoiler.ts index 507414dc70..32526a0820 100644 --- a/src/lib/richTextProcessor/spoiler.ts +++ b/src/lib/richTextProcessor/spoiler.ts @@ -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('');