about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/util/html.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/javascript/flavours/glitch/util/html.js')
-rw-r--r--app/javascript/flavours/glitch/util/html.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/util/html.js b/app/javascript/flavours/glitch/util/html.js
new file mode 100644
index 000000000..0b646ce58
--- /dev/null
+++ b/app/javascript/flavours/glitch/util/html.js
@@ -0,0 +1,6 @@
+export const unescapeHTML = (html) => {
+  const wrapper = document.createElement('div');
+  html = html.replace(/<br \/>|<br>|\n/g, ' ');
+  wrapper.innerHTML = html;
+  return wrapper.textContent;
+};