Thibaut Girka 26c20a4ec7 [Glitch] Preserve newlines in delete & redraft and desktop notifications
Port c75493755f482d0506884b1f7b7b44e5306a4d8b to glitch-soc
2018-06-16 15:09:28 +02:00

6 lines
232 B
JavaScript

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;
};