![JAR search and dependency download from the Maven repository](/logo.png)
app.panels.text.module.js Maven / Gradle / Ivy
The newest version!
/** @scratch /panels/5
*
* include::panels/text.asciidoc[]
*/
/** @scratch /panels/text/0
* == text
* Status: *Stable*
*
* The text panel is used for displaying static text formated as markdown, sanitized html or as plain
* text.
*
*/
define([
'angular',
'app',
'lodash',
'require'
],
function (angular, app, _, require) {
'use strict';
var module = angular.module('kibana.panels.text', []);
app.useModule(module);
module.controller('text', function($scope) {
$scope.panelMeta = {
status : "Stable",
description : "A static text panel that can use plain text, markdown, or (sanitized) HTML"
};
// Set and populate defaults
var _d = {
/** @scratch /panels/text/5
*
* === Parameters
*
* mode:: `html', `markdown' or `text'
*/
mode : "markdown", // 'html','markdown','text'
/** @scratch /panels/text/5
* content:: The content of your panel, written in the mark up specified in +mode+
*/
content : "",
style: {},
};
_.defaults($scope.panel,_d);
$scope.init = function() {
$scope.ready = false;
};
});
module.directive('markdown', function() {
return {
restrict: 'E',
link: function(scope, element) {
scope.$on('render', function() {
render_panel();
});
function render_panel() {
require(['./lib/showdown'], function (Showdown) {
scope.ready = true;
var converter = new Showdown.converter();
var text = scope.panel.content.replace(/&/g, '&')
.replace(/>/g, '>')
.replace(/');
};
});
module.filter('striphtml', function () {
return function(text) {
return text
.replace(/&/g, '&')
.replace(/>/g, '>')
.replace(/
© 2015 - 2025 Weber Informatics LLC | Privacy Policy