Gab Social. All are welcome.
This commit is contained in:
6
app/javascript/gabsocial/utils/html.js
Normal file
6
app/javascript/gabsocial/utils/html.js
Normal file
@@ -0,0 +1,6 @@
|
||||
// NB: This function can still return unsafe HTML
|
||||
export const unescapeHTML = (html) => {
|
||||
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