[Glitch] Converted app/javascript/flavours/glitch/utils/ folder to TypeScript
Port 1142f4c79e to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
1 parent
52c023a305
commit
695dcc6ca8
10 files changed
+77
-75
No files matched your search
@@ -0,0 +1,9 @@
|
||||
// NB: This function can still return unsafe HTML
|
||||
export const unescapeHTML = (html: string) => {
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.innerHTML = html
|
||||
.replace(/<br\s*\/?>/g, '\n')
|
||||
.replace(/<\/p><p>/g, '\n\n')
|
||||
.replace(/<[^>]*>/g, '');
|
||||
return wrapper.textContent;
|
||||
};
|
||||
Reference in new issue
Block a user