Commit 6d366410 by Torkel Ödegaard

fix(text panel): fixed escaping issue with markdown in text panel, fixes #4409

parent 662dbaf8
......@@ -12,7 +12,7 @@ var panelDefaults = {
export class TextPanelCtrl extends PanelCtrl {
static templateUrl = `public/app/plugins/panel/text/module.html`;
converter: any;
remarkable: any;
content: string;
/** @ngInject */
......@@ -54,21 +54,16 @@ export class TextPanelCtrl extends PanelCtrl {
}
renderMarkdown(content) {
var text = content
.replace(/&/g, '&')
.replace(/>/g, '>')
.replace(/</g, '&lt;');
if (this.converter) {
this.updateContent(this.converter.makeHtml(text));
} else {
if (!this.remarkable) {
return System.import('remarkable').then(Remarkable => {
var md = new Remarkable();
this.remarkable = new Remarkable();
this.$scope.$apply(() => {
this.updateContent(md.render(text));
this.updateContent(this.remarkable.render(content));
});
});
}
this.updateContent(this.remarkable.render(content));
}
updateContent(html) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment