diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-20 10:41:11 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-20 10:41:11 +0100 |
commit | 5de8a55abce53108bc1024f1194457c6528bd11e (patch) | |
tree | 24d55c349807581a86872490753c2e1bddff932d /client/src/app/shared/misc | |
parent | 2f315e2f915514eaddee30394b0d99790bcda06b (diff) | |
download | PeerTube-5de8a55abce53108bc1024f1194457c6528bd11e.tar.gz PeerTube-5de8a55abce53108bc1024f1194457c6528bd11e.tar.zst PeerTube-5de8a55abce53108bc1024f1194457c6528bd11e.zip |
Handle line feeds in comments
Diffstat (limited to 'client/src/app/shared/misc')
-rw-r--r-- | client/src/app/shared/misc/utils.ts | 9 |
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 | ||
91 | function lineFeedToHtml (obj: object, keyToNormalize: string) { | ||
92 | return immutableAssign(obj, { | ||
93 | [keyToNormalize]: obj[keyToNormalize].replace(/\r?\n|\r/g, '<br />') | ||
94 | }) | ||
95 | } | ||
96 | |||
91 | export { | 97 | export { |
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 | } |