Skip to content

Commit bf14c86

Browse files
authored
Merge pull request #350 from 0x41head/circular-desc-fix
feat: fixes markdown render issue in circular heatmap
2 parents fd118d7 + 4b888e5 commit bf14c86

2 files changed

Lines changed: 24 additions & 14 deletions

File tree

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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,17 @@ export class CircularHeatmapComponent implements OnInit {
717717
}
718718
}
719719

720+
defineStringValues(
721+
dataToCheck: string,
722+
valueOfDataIfUndefined: string
723+
): string {
724+
try {
725+
return this.markdown.render(dataToCheck);
726+
} catch {
727+
return valueOfDataIfUndefined;
728+
}
729+
}
730+
720731
openActivityDetails(dim: string, subdim: string, activityName: string) {
721732
let navigationExtras = {
722733
dimension: dim,
@@ -727,7 +738,18 @@ export class CircularHeatmapComponent implements OnInit {
727738
{},
728739
this.YamlObject[dim][subdim][activityName]
729740
);
730-
741+
this.activityDetails.description = this.defineStringValues(
742+
this.activityDetails.description,
743+
this.activityDetails.description
744+
);
745+
this.activityDetails.risk = this.defineStringValues(
746+
this.activityDetails.risk,
747+
this.activityDetails.risk
748+
);
749+
this.activityDetails.measure = this.defineStringValues(
750+
this.activityDetails.measure,
751+
this.activityDetails.measure
752+
);
731753
if (this.activityDetails) {
732754
this.activityDetails.navigationExtras = navigationExtras;
733755
}

0 commit comments

Comments
 (0)