Skip to content

Commit

Permalink
- add rich text editor
Browse files Browse the repository at this point in the history
  • Loading branch information
mkolkowski committed Jun 2, 2016
1 parent 43a3c60 commit 75fe017
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "public/bower_components"
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Gravity Widget Plugin for Kibana.
# Install

```bash
cd ./kibana-gravity
bower install
cp -R ./kibana-gravity kibana/src/plugins/
```

Expand Down
28 changes: 28 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "kibana-gravity",
"description": "Kibana Gravity Plugin Widget",
"main": "index.js",
"authors": [
"Marius Kolkowski <[email protected]>"
],
"license": "Apache 2.0",
"keywords": [
"kibana",
"gravity",
"plugin",
"widget",
"raystorm"
],
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"ace-builds": "1.2.3",
"angular-ui-ace": "0.2.3"
}
}
5 changes: 4 additions & 1 deletion public/gravity.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
define(function (require) {
// we need to load the css ourselves
require('plugins/kibana-gravity/bower_components/ace-builds/src-min-noconflict/ace.js');
require('plugins/kibana-gravity/bower_components/ace-builds/src-min-noconflict/mode-html.js');
require('plugins/kibana-gravity/bower_components/ace-builds/src-min-noconflict/theme-monokai.js');
require('plugins/kibana-gravity/bower_components/angular-ui-ace/ui-ace.min.js');
require('plugins/kibana-gravity/gravity.less');

// we also need to load the controller and used by the template
Expand Down
9 changes: 9 additions & 0 deletions public/gravity.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
width: 100%;
}

.vis-editor-sidebar {
max-width: 600px;
}

.html-gravity-editor {
min-height: 500px;
min-width: 600px;
}

.vis-editor {

&.vis-type-markdown {
Expand Down
9 changes: 8 additions & 1 deletion public/gravity_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ define(function (require) {

require('ui/notify');

var module = require('ui/modules').get('kibana/kibana-gravity', ['kibana']);
var module = require('ui/modules').get('kibana/kibana-gravity', ['kibana', 'ui.ace']);
module.service('gravityHelper', [function () {
this.elasticHitToGravity = function(hit) {
var gravity = {
Expand All @@ -20,6 +20,13 @@ define(function (require) {
return gravity;
};
}]);

module.controller('KbnGravityEditController', ['$scope', function($scope) {
$scope.aceLoaded = function(_editor){
_editor.$blockScrolling = Infinity;
};
}]);

module.controller('KbnGravityVisController', function ($scope, $compile, $interpolate, $sce, courier, Private, Promise, Notifier,
gravityHelper, savedSearches, timefilter, AppState) {
var HitSortFn = Private(require('plugins/kibana/discover/_hit_sort_fn'));
Expand Down
4 changes: 3 additions & 1 deletion public/gravity_params.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
<div>
<label>HTML</label>
</div>
<textarea ng-model="vis.params.html" class="form-control" rows="20"></textarea>
<div ng-controller="KbnGravityEditController">
<div ui-ace="{theme: 'monokai', mode: 'html', onLoad: aceLoaded }" class="html-gravity-editor" ng-model="vis.params.html"></div>
</div>
</div>

0 comments on commit 75fe017

Please sign in to comment.