aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-20 10:41:11 +0100
committerChocobozzz <me@florianbigard.com>2018-02-20 10:41:11 +0100
commit5de8a55abce53108bc1024f1194457c6528bd11e (patch)
tree24d55c349807581a86872490753c2e1bddff932d /client/src/app/shared
parent2f315e2f915514eaddee30394b0d99790bcda06b (diff)
downloadPeerTube-5de8a55abce53108bc1024f1194457c6528bd11e.tar.gz
PeerTube-5de8a55abce53108bc1024f1194457c6528bd11e.tar.zst
PeerTube-5de8a55abce53108bc1024f1194457c6528bd11e.zip
Handle line feeds in comments
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/misc/utils.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts
index e2e4c5b36..64bc69b0d 100644
--- a/client/src/app/shared/misc/utils.ts
+++ b/client/src/app/shared/misc/utils.ts
@@ -88,6 +88,12 @@ function objectToFormData (obj: any, form?: FormData, namespace?: string) {
88 return fd 88 return fd
89} 89}
90 90
91function lineFeedToHtml (obj: object, keyToNormalize: string) {
92 return immutableAssign(obj, {
93 [keyToNormalize]: obj[keyToNormalize].replace(/\r?\n|\r/g, '<br />')
94 })
95}
96
91export { 97export {
92 viewportHeight, 98 viewportHeight,
93 getParameterByName, 99 getParameterByName,
@@ -97,5 +103,6 @@ export {
97 isInSmallView, 103 isInSmallView,
98 isInMobileView, 104 isInMobileView,
99 immutableAssign, 105 immutableAssign,
100 objectToFormData 106 objectToFormData,
107 lineFeedToHtml
101} 108}