Skip to content

Commit

Permalink
Merge pull request #17 from opf/fix/angular-standalone-components
Browse files Browse the repository at this point in the history
fix: mark SVG path as sanitized
  • Loading branch information
b12f authored Jul 20, 2023
2 parents 9ae3219 + 1004d47 commit b72143a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/pretty-bottles-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@openproject/octicons': patch
---

fix: mark SVG Path as sanitized
2 changes: 1 addition & 1 deletion lib/octicons_angular/script/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const icons = Object.entries(octicons)
template: \`
<title *ngIf="title">{{title}}</title>
<path [outerHTML]="path"></path>
<path [outerHTML]="sanitizer.bypassSecurityTrustHtml(path)"></path>
\`,
})
export class Op${name} extends OpOcticonComponentBase {
Expand Down
3 changes: 3 additions & 0 deletions lib/octicons_angular/src/octicon-component-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Input,
HostBinding
} from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { closestNaturalHeight } from './helpers';

@Directive({})
Expand Down Expand Up @@ -71,4 +72,6 @@ export class OpOcticonComponentBase {
path: string,
};
} = {};

constructor(protected sanitizer:DomSanitizer) {}
}

0 comments on commit b72143a

Please sign in to comment.