MOBILE-3348 format-text: Re-filter if context data changes
parent
6d06a7e41c
commit
7256929fd2
|
@ -9,7 +9,7 @@
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
<core-loading [hideUntil]="loaded">
|
<core-loading [hideUntil]="loaded">
|
||||||
<ng-container *ngIf="entry">
|
<ng-container *ngIf="entry && loaded">
|
||||||
<ion-item text-wrap *ngIf="showAuthor">
|
<ion-item text-wrap *ngIf="showAuthor">
|
||||||
<ion-avatar core-user-avatar [user]="entry" (click)="openUserProfile(post.userid)" item-start></ion-avatar>
|
<ion-avatar core-user-avatar [user]="entry" (click)="openUserProfile(post.userid)" item-start></ion-avatar>
|
||||||
<h2><core-format-text [text]="entry.concept" contextLevel="module" [contextInstanceId]="glossary && glossary.coursemodule" [courseId]="courseId"></core-format-text></h2>
|
<h2><core-format-text [text]="entry.concept" contextLevel="module" [contextInstanceId]="glossary && glossary.coursemodule" [courseId]="courseId"></core-format-text></h2>
|
||||||
|
|
|
@ -106,7 +106,7 @@ export class CoreFormatTextDirective implements OnChanges {
|
||||||
* Detect changes on input properties.
|
* Detect changes on input properties.
|
||||||
*/
|
*/
|
||||||
ngOnChanges(changes: { [name: string]: SimpleChange }): void {
|
ngOnChanges(changes: { [name: string]: SimpleChange }): void {
|
||||||
if (changes.text) {
|
if (changes.text || changes.filter || changes.contextLevel || changes.contextInstanceId) {
|
||||||
this.hideShowMore();
|
this.hideShowMore();
|
||||||
this.formatAndRenderContents();
|
this.formatAndRenderContents();
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ export class CoreFormatTextDirective implements OnChanges {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// Open a new state with the contents.
|
// Open a new state with the contents.
|
||||||
const filter = this.utils.isTrueOrOne(this.filter);
|
const filter = typeof this.filter != 'undefined' ? this.utils.isTrueOrOne(this.filter) : undefined;
|
||||||
|
|
||||||
this.textUtils.expandText(this.fullTitle || this.translate.instant('core.description'), this.text,
|
this.textUtils.expandText(this.fullTitle || this.translate.instant('core.description'), this.text,
|
||||||
this.component, this.componentId, undefined, filter, this.contextLevel, this.contextInstanceId, this.courseId);
|
this.component, this.componentId, undefined, filter, this.contextLevel, this.contextInstanceId, this.courseId);
|
||||||
|
@ -413,8 +413,8 @@ export class CoreFormatTextDirective implements OnChanges {
|
||||||
this.contextInstanceId = site.getSiteHomeId();
|
this.contextInstanceId = site.getSiteHomeId();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.filter = typeof this.filter == 'undefined' ?
|
const filter = typeof this.filter == 'undefined' ?
|
||||||
!!(this.contextLevel && typeof this.contextInstanceId != 'undefined') : !!this.filter;
|
!!(this.contextLevel && typeof this.contextInstanceId != 'undefined') : this.utils.isTrueOrOne(this.filter);
|
||||||
|
|
||||||
result.options = {
|
result.options = {
|
||||||
clean: this.utils.isTrueOrOne(this.clean),
|
clean: this.utils.isTrueOrOne(this.clean),
|
||||||
|
@ -424,7 +424,7 @@ export class CoreFormatTextDirective implements OnChanges {
|
||||||
wsNotFiltered: this.utils.isTrueOrOne(this.wsNotFiltered)
|
wsNotFiltered: this.utils.isTrueOrOne(this.wsNotFiltered)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.filter) {
|
if (filter) {
|
||||||
return this.filterHelper.getFiltersAndFormatText(this.text, this.contextLevel, this.contextInstanceId,
|
return this.filterHelper.getFiltersAndFormatText(this.text, this.contextLevel, this.contextInstanceId,
|
||||||
result.options, result.siteId).then((res) => {
|
result.options, result.siteId).then((res) => {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue