Merge pull request #3026 from coreos-inc/joseph.schorr/QUAY-840/markdown-error-fix

Fix bug in the markdown viewer
This commit is contained in:
josephschorr 2018-03-16 12:34:38 -04:00 committed by GitHub
commit 6212e552eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,7 +30,7 @@ export class MarkdownViewComponent implements OnChanges {
if (changes['content']) {
if (!changes['content'].currentValue && this.placeholderNeeded) {
this.convertedHTML = this.$sce.trustAsHtml(this.placeholder);
} else if (this.firstLineOnly) {
} else if (this.firstLineOnly && changes['content'].currentValue) {
const firstLine: string = changes['content'].currentValue.split('\n')
// Skip code lines
.filter(line => line.indexOf(' ') != 0)
@ -41,9 +41,8 @@ export class MarkdownViewComponent implements OnChanges {
this.convertedHTML = this.$sanitize(this.markdownConverter.makeHtml(firstLine));
} else {
this.convertedHTML = this.$sanitize(this.markdownConverter.makeHtml(changes['content'].currentValue));
this.convertedHTML = this.$sanitize(this.markdownConverter.makeHtml(changes['content'].currentValue || ''));
}
}
}
}