about summary refs log tree commit diff
path: root/app/javascript/mastodon/utils
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-05-07 09:30:38 +0200
committerGitHub <noreply@github.com>2018-05-07 09:30:38 +0200
commitd185f3ddafc941e280de7efc6d448449ab5ce2c9 (patch)
tree1d3ee8ab74251168e98dccd7d232ed8c1a364e82 /app/javascript/mastodon/utils
parentdb012b57c2c3e65cfbd7d9b51e0c3081ed883400 (diff)
Use plaintext value for field value tooltips in web UI (#7388)
Fix #7383
Diffstat (limited to 'app/javascript/mastodon/utils')
-rw-r--r--app/javascript/mastodon/utils/html.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/javascript/mastodon/utils/html.js b/app/javascript/mastodon/utils/html.js
new file mode 100644
index 000000000..0b646ce58
--- /dev/null
+++ b/app/javascript/mastodon/utils/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;
+};