diff options
author | ThibG <thib@sitedethib.com> | 2018-05-11 16:26:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-11 16:26:23 +0200 |
commit | 479e5bbd4aaa4b3da3aa78f560facb9856bcdf45 (patch) | |
tree | 184de738f4084a55c1798321b0b41ff37efe2517 /app/javascript/flavours/glitch/util/html.js | |
parent | 34142ab29c33104793afe3199f102d84b83b9b57 (diff) | |
parent | f6ec8c48210f6bce421d0d7248737d028ae88ee3 (diff) |
Merge pull request #474 from ThibG/glitch-soc/fixes/html-ified-tooltip
[Glitch] Use plaintext value for field value tooltips in web UI
Diffstat (limited to 'app/javascript/flavours/glitch/util/html.js')
-rw-r--r-- | app/javascript/flavours/glitch/util/html.js | 6 |
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; +}; |