Fix bug in the markdown viewer

Fixes https://jira.coreos.com/browse/QUAY-840
This commit is contained in:
Joseph Schorr 2018-03-16 12:28:32 -04:00
parent 32a473d23c
commit 3ebcc07fec

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 || ''));
}
}
}
}