Commit 2ac7b9da by Torkel Ödegaard

Merge branch 'master' of github.com:Akeru/grafana into Akeru-master

parents 505f0f65 c100054d
<div ng-controller='text' ng-init="init()" style="min-height:{{panel.height || row.height}}" ng-dblclick="openEditor()"> <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>--> <!--<p ng-style="panel.style" ng-bind-html-unsafe="panel.content | striphtml | newlines"></p>-->
<markdown ng-show="ready && panel.mode == 'markdown'"> <markdown ng-show="ready && panel.mode == 'markdown'" ng-bind-html-unsafe="panel.content | applymarkdown | applytemplate">
{{panel.content}}
</markdown> </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>
<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> </p>
</div> </div>
...@@ -14,7 +14,8 @@ define([ ...@@ -14,7 +14,8 @@ define([
'angular', 'angular',
'app', 'app',
'underscore', 'underscore',
'require' 'require',
'services/filterSrv'
], ],
function (angular, app, _, require) { function (angular, app, _, require) {
'use strict'; 'use strict';
...@@ -98,4 +99,25 @@ function (angular, app, _, require) { ...@@ -98,4 +99,25 @@ function (angular, app, _, require) {
.replace(/</g, '&lt;'); .replace(/</g, '&lt;');
}; };
}); });
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, '&amp;')
.replace(/>/g, '&gt;')
.replace(/</g, '&lt;');
return converter.makeHtml(text);
} else {
return input;
}
};
});
}); });
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