diff --git a/src/main/webapp/app/shared/metis/posting-content/posting-content-part/posting-content-part.components.ts b/src/main/webapp/app/shared/metis/posting-content/posting-content-part/posting-content-part.components.ts index a485184bd3df..a6dc5adb939b 100644 --- a/src/main/webapp/app/shared/metis/posting-content/posting-content-part/posting-content-part.components.ts +++ b/src/main/webapp/app/shared/metis/posting-content/posting-content-part/posting-content-part.components.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; import { PostingContentPart, ReferenceType } from '../../metis.util'; import { FileService } from 'app/shared/http/file.service'; @@ -27,7 +27,7 @@ import { AccountService } from 'app/core/auth/account.service'; templateUrl: './posting-content-part.component.html', styleUrls: ['./../../metis.component.scss'], }) -export class PostingContentPartComponent implements OnInit { +export class PostingContentPartComponent implements OnChanges, OnInit { @Input() postingContentPart: PostingContentPart; @Output() userReferenceClicked = new EventEmitter(); @Output() channelReferenceClicked = new EventEmitter(); @@ -56,10 +56,16 @@ export class PostingContentPartComponent implements OnInit { private accountService: AccountService, ) {} - ngOnInit() { + ngOnInit(): void { this.processContent(); } + ngOnChanges(changes: SimpleChanges): void { + if (changes.postingContentPart && !changes.postingContentPart.firstChange) { + this.processContent(); + } + } + /** * Opens an attachment with the given URL in a new window *