about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/util/html.js
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-06-15 21:31:08 +0200
committerThibG <thib@sitedethib.com>2018-06-16 15:09:28 +0200
commit26c20a4ec7868753b284670575f28f201a5cef9f (patch)
tree3335c2dee439be101e89d23b27736b0f614a445c /app/javascript/flavours/glitch/util/html.js
parenta01faecfcb9ee3d73ba84bec43536bde0f93d1cf (diff)
[Glitch] Preserve newlines in delete & redraft and desktop notifications
Port c75493755f482d0506884b1f7b7b44e5306a4d8b to glitch-soc
Diffstat (limited to 'app/javascript/flavours/glitch/util/html.js')
-rw-r--r--app/javascript/flavours/glitch/util/html.js3
1 files changed, 1 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/util/html.js b/app/javascript/flavours/glitch/util/html.js
index 0b646ce58..5159df9db 100644
--- a/app/javascript/flavours/glitch/util/html.js
+++ b/app/javascript/flavours/glitch/util/html.js
@@ -1,6 +1,5 @@
 export const unescapeHTML = (html) => {
   const wrapper = document.createElement('div');
-  html = html.replace(/<br \/>|<br>|\n/g, ' ');
-  wrapper.innerHTML = html;
+  wrapper.innerHTML = html.replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n').replace(/<[^>]*>/g, '');
   return wrapper.textContent;
 };