Frontend: Added ParagraphPipe
This commit is contained in:
1 parent
1a18b826de
commit
996c445020
2 files changed
+21
-4
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'paragraph'
|
||||
})
|
||||
export class ParagraphPipe implements PipeTransform {
|
||||
transform(value: string): string {
|
||||
if (!value) return '';
|
||||
|
||||
// Replace newlines with paragraph tags
|
||||
const paragraphs = value.split(/\n+/);
|
||||
return paragraphs
|
||||
.map(p => `<p>${p}</p>`)
|
||||
.join('');
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import { ConfirmModalComponent } from './components/modals/confirm-modal/confirm
|
||||
|
||||
// * pipes
|
||||
import { DateFormatPipe } from './pipes/date-format/date-format.pipe';
|
||||
import { ParagraphPipe } from './pipes/paragraph.pipe';
|
||||
|
||||
// * other
|
||||
import { RatingModule } from 'ngx-bootstrap/rating';
|
||||
@@ -34,14 +35,14 @@ import { MediaSelectorPipe } from './pipes/media-selector/media-selector.pipe';
|
||||
|
||||
RatingModule.forRoot(),
|
||||
ToastrModule.forRoot(),
|
||||
],
|
||||
declarations: [
|
||||
], declarations: [
|
||||
// * pipes
|
||||
DateFormatPipe,
|
||||
FloatFormatPipe,
|
||||
MinutesFormatPipe,
|
||||
BetterMinutesFormatPipe,
|
||||
MediaSelectorPipe,
|
||||
ParagraphPipe,
|
||||
|
||||
// * directives
|
||||
StopScrollDirective,
|
||||
@@ -58,14 +59,14 @@ import { MediaSelectorPipe } from './pipes/media-selector/media-selector.pipe';
|
||||
NotificationPopupComponent,
|
||||
|
||||
ContextMenuComponent,
|
||||
],
|
||||
exports: [
|
||||
], exports: [
|
||||
// * pipes
|
||||
DateFormatPipe,
|
||||
FloatFormatPipe,
|
||||
MinutesFormatPipe,
|
||||
BetterMinutesFormatPipe,
|
||||
MediaSelectorPipe,
|
||||
ParagraphPipe,
|
||||
|
||||
// * directives
|
||||
StopScrollDirective,
|
||||
|
||||
Reference in new issue
Block a user