|
@@ -1,5 +1,6 @@
|
|
|
import _ from 'lodash';
|
|
import _ from 'lodash';
|
|
|
import Remarkable from 'remarkable';
|
|
import Remarkable from 'remarkable';
|
|
|
|
|
+import { sanitize, escapeHtml } from 'app/core/utils/text';
|
|
|
|
|
|
|
|
import config from 'app/core/config';
|
|
import config from 'app/core/config';
|
|
|
import { profiler } from 'app/core/core';
|
|
import { profiler } from 'app/core/core';
|
|
@@ -254,30 +255,31 @@ export class PanelCtrl {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const linkSrv: LinkSrv = this.$injector.get('linkSrv');
|
|
const linkSrv: LinkSrv = this.$injector.get('linkSrv');
|
|
|
- const sanitize: any = this.$injector.get('$sanitize');
|
|
|
|
|
const templateSrv: TemplateSrv = this.$injector.get('templateSrv');
|
|
const templateSrv: TemplateSrv = this.$injector.get('templateSrv');
|
|
|
const interpolatedMarkdown = templateSrv.replace(markdown, this.panel.scopedVars);
|
|
const interpolatedMarkdown = templateSrv.replace(markdown, this.panel.scopedVars);
|
|
|
let html = '<div class="markdown-html">';
|
|
let html = '<div class="markdown-html">';
|
|
|
|
|
|
|
|
- html += new Remarkable().render(interpolatedMarkdown);
|
|
|
|
|
|
|
+ const md = new Remarkable().render(interpolatedMarkdown);
|
|
|
|
|
+ html += config.disableSanitizeHtml ? md : sanitize(md);
|
|
|
|
|
|
|
|
if (this.panel.links && this.panel.links.length > 0) {
|
|
if (this.panel.links && this.panel.links.length > 0) {
|
|
|
html += '<ul>';
|
|
html += '<ul>';
|
|
|
for (const link of this.panel.links) {
|
|
for (const link of this.panel.links) {
|
|
|
const info = linkSrv.getPanelLinkAnchorInfo(link, this.panel.scopedVars);
|
|
const info = linkSrv.getPanelLinkAnchorInfo(link, this.panel.scopedVars);
|
|
|
|
|
+
|
|
|
html +=
|
|
html +=
|
|
|
'<li><a class="panel-menu-link" href="' +
|
|
'<li><a class="panel-menu-link" href="' +
|
|
|
- info.href +
|
|
|
|
|
|
|
+ escapeHtml(info.href) +
|
|
|
'" target="' +
|
|
'" target="' +
|
|
|
- info.target +
|
|
|
|
|
|
|
+ escapeHtml(info.target) +
|
|
|
'">' +
|
|
'">' +
|
|
|
- info.title +
|
|
|
|
|
|
|
+ escapeHtml(info.title) +
|
|
|
'</a></li>';
|
|
'</a></li>';
|
|
|
}
|
|
}
|
|
|
html += '</ul>';
|
|
html += '</ul>';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
html += '</div>';
|
|
html += '</div>';
|
|
|
- return sanitize(html);
|
|
|
|
|
|
|
+ return html;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|