Skip to content

Commit d5f9f41

Browse files
committed
fixed markdown render issue in circular heatmap
1 parent 9c33198 commit d5f9f41

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

src/app/component/circular-heatmap/circular-heatmap.component.html

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,7 @@ <h2>Nothing to show</h2>
4545
</mat-panel-title>
4646
</mat-expansion-panel-header>
4747
<ng-template matExpansionPanelContent>
48-
<div
49-
*ngIf="
50-
markdown.render(activityDetails.description);
51-
else ifFileIsNotAMarkdown
52-
">
53-
<p
54-
[innerHTML]="
55-
markdown.render(activityDetails.description)
56-
"></p>
57-
</div>
58-
<ng-template #ifFileIsNotAMarkdown>
59-
<p [innerHTML]="activityDetails.description"></p>
60-
</ng-template>
48+
<p [innerHTML]="activityDetails.description"></p>
6149
</ng-template>
6250
</mat-expansion-panel>
6351
<mat-expansion-panel

src/app/component/circular-heatmap/circular-heatmap.component.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,17 @@ export class CircularHeatmapComponent implements OnInit {
746746
}
747747
}
748748

749+
defineStringValues(
750+
dataToCheck: string,
751+
valueOfDataIfUndefined: string
752+
): string {
753+
try {
754+
return this.markdown.render(dataToCheck);
755+
} catch {
756+
return valueOfDataIfUndefined;
757+
}
758+
}
759+
749760
navigate(dim: string, subdim: string, activityName: string) {
750761
let navigationExtras = {
751762
dimension: dim,
@@ -754,6 +765,18 @@ export class CircularHeatmapComponent implements OnInit {
754765
};
755766
this.yaml.setURI('./assets/YAML/generated/generated.yaml');
756767
this.activityDetails = this.YamlObject[dim][subdim][activityName];
768+
this.activityDetails.description = this.defineStringValues(
769+
this.activityDetails.description,
770+
this.activityDetails.description
771+
);
772+
this.activityDetails.risk = this.defineStringValues(
773+
this.activityDetails.risk,
774+
this.activityDetails.risk
775+
);
776+
this.activityDetails.measure = this.defineStringValues(
777+
this.activityDetails.measure,
778+
this.activityDetails.measure
779+
);
757780
console.log(this.YamlObject);
758781
console.log(this.YamlObject[dim][subdim]);
759782
if (this.activityDetails) {

0 commit comments

Comments
 (0)