mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'master' of github.com:Akeru/grafana into Akeru-master
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
<div ng-controller='text' ng-init="init()" style="min-height:{{panel.height || row.height}}" ng-dblclick="openEditor()">
|
||||
<!--<p ng-style="panel.style" ng-bind-html-unsafe="panel.content | striphtml | newlines"></p>-->
|
||||
<markdown ng-show="ready && panel.mode == 'markdown'">
|
||||
{{panel.content}}
|
||||
<markdown ng-show="ready && panel.mode == 'markdown'" ng-bind-html-unsafe="panel.content | applymarkdown | applytemplate">
|
||||
</markdown>
|
||||
<p ng-show="panel.mode == 'text'" ng-style='panel.style' ng-bind-html-unsafe="panel.content | striphtml | newlines">
|
||||
<p ng-show="panel.mode == 'text'" ng-style='panel.style' ng-bind-html-unsafe="panel.content | striphtml | newlines | applytemplate">
|
||||
</p>
|
||||
<p ng-show="panel.mode == 'html'" ng-bind-html-unsafe="panel.content">
|
||||
<p ng-show="panel.mode == 'html'" ng-bind-html-unsafe="panel.content | applytemplate">
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,8 @@ define([
|
||||
'angular',
|
||||
'app',
|
||||
'underscore',
|
||||
'require'
|
||||
'require',
|
||||
'services/filterSrv'
|
||||
],
|
||||
function (angular, app, _, require) {
|
||||
'use strict';
|
||||
@@ -98,4 +99,25 @@ function (angular, app, _, require) {
|
||||
.replace(/</g, '<');
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
module.filter('applytemplate', function(filterSrv) {
|
||||
return function (input) {
|
||||
return filterSrv.applyTemplateToTarget(input);
|
||||
};
|
||||
});
|
||||
|
||||
module.filter('applymarkdown', function() {
|
||||
return function (input) {
|
||||
if(require.defined('./lib/showdown')) {
|
||||
var Showdown = require('./lib/showdown');
|
||||
var converter = new Showdown.converter();
|
||||
var text = input.replace(/&/g, '&')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/</g, '<');
|
||||
return converter.makeHtml(text);
|
||||
} else {
|
||||
return input;
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user