Skip to content

Commit

Permalink
Merge pull request #350 from 0x41head/circular-desc-fix
Browse files Browse the repository at this point in the history
feat: fixes markdown render issue in circular heatmap
  • Loading branch information
wurstbrot authored Jan 13, 2025
2 parents fd118d7 + 4b888e5 commit bf14c86
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,7 @@ <h2>Nothing to show</h2>
</mat-panel-title>
</mat-expansion-panel-header>
<ng-template matExpansionPanelContent>
<div
*ngIf="
markdown.render(activityDetails.description);
else ifFileIsNotAMarkdown
">
<p
[innerHTML]="
markdown.render(activityDetails.description)
"></p>
</div>
<ng-template #ifFileIsNotAMarkdown>
<p [innerHTML]="activityDetails.description"></p>
</ng-template>
<p [innerHTML]="activityDetails.description"></p>
</ng-template>
</mat-expansion-panel>
<mat-expansion-panel
Expand Down
24 changes: 23 additions & 1 deletion src/app/component/circular-heatmap/circular-heatmap.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,17 @@ export class CircularHeatmapComponent implements OnInit {
}
}

defineStringValues(
dataToCheck: string,
valueOfDataIfUndefined: string
): string {
try {
return this.markdown.render(dataToCheck);
} catch {
return valueOfDataIfUndefined;
}
}

openActivityDetails(dim: string, subdim: string, activityName: string) {
let navigationExtras = {
dimension: dim,
Expand All @@ -727,7 +738,18 @@ export class CircularHeatmapComponent implements OnInit {
{},
this.YamlObject[dim][subdim][activityName]
);

this.activityDetails.description = this.defineStringValues(
this.activityDetails.description,
this.activityDetails.description
);
this.activityDetails.risk = this.defineStringValues(
this.activityDetails.risk,
this.activityDetails.risk
);
this.activityDetails.measure = this.defineStringValues(
this.activityDetails.measure,
this.activityDetails.measure
);
if (this.activityDetails) {
this.activityDetails.navigationExtras = navigationExtras;
}
Expand Down

0 comments on commit bf14c86

Please sign in to comment.