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
|
// * pipes
|
||||||
import { DateFormatPipe } from './pipes/date-format/date-format.pipe';
|
import { DateFormatPipe } from './pipes/date-format/date-format.pipe';
|
||||||
|
import { ParagraphPipe } from './pipes/paragraph.pipe';
|
||||||
|
|
||||||
// * other
|
// * other
|
||||||
import { RatingModule } from 'ngx-bootstrap/rating';
|
import { RatingModule } from 'ngx-bootstrap/rating';
|
||||||
@@ -34,14 +35,14 @@ import { MediaSelectorPipe } from './pipes/media-selector/media-selector.pipe';
|
|||||||
|
|
||||||
RatingModule.forRoot(),
|
RatingModule.forRoot(),
|
||||||
ToastrModule.forRoot(),
|
ToastrModule.forRoot(),
|
||||||
],
|
], declarations: [
|
||||||
declarations: [
|
|
||||||
// * pipes
|
// * pipes
|
||||||
DateFormatPipe,
|
DateFormatPipe,
|
||||||
FloatFormatPipe,
|
FloatFormatPipe,
|
||||||
MinutesFormatPipe,
|
MinutesFormatPipe,
|
||||||
BetterMinutesFormatPipe,
|
BetterMinutesFormatPipe,
|
||||||
MediaSelectorPipe,
|
MediaSelectorPipe,
|
||||||
|
ParagraphPipe,
|
||||||
|
|
||||||
// * directives
|
// * directives
|
||||||
StopScrollDirective,
|
StopScrollDirective,
|
||||||
@@ -58,14 +59,14 @@ import { MediaSelectorPipe } from './pipes/media-selector/media-selector.pipe';
|
|||||||
NotificationPopupComponent,
|
NotificationPopupComponent,
|
||||||
|
|
||||||
ContextMenuComponent,
|
ContextMenuComponent,
|
||||||
],
|
], exports: [
|
||||||
exports: [
|
|
||||||
// * pipes
|
// * pipes
|
||||||
DateFormatPipe,
|
DateFormatPipe,
|
||||||
FloatFormatPipe,
|
FloatFormatPipe,
|
||||||
MinutesFormatPipe,
|
MinutesFormatPipe,
|
||||||
BetterMinutesFormatPipe,
|
BetterMinutesFormatPipe,
|
||||||
MediaSelectorPipe,
|
MediaSelectorPipe,
|
||||||
|
ParagraphPipe,
|
||||||
|
|
||||||
// * directives
|
// * directives
|
||||||
StopScrollDirective,
|
StopScrollDirective,
|
||||||
|
|||||||
Reference in new issue
Block a user