@kigi/components 1.5.6 → 1.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kigi/components",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -7,6 +7,7 @@ class MbgAceEditorController {
7
7
  private ngChange
8
8
  private ngModel
9
9
  private variables: IMbgAceEditorVariables[]
10
+ private editorRef
10
11
 
11
12
  constructor(private $scope, private $element, private $attrs) {}
12
13
 
@@ -17,6 +18,7 @@ class MbgAceEditorController {
17
18
  }
18
19
 
19
20
  onLoad(editor, variables) {
21
+ this.editorRef = editor
20
22
  const ace = (<any>window).ace
21
23
  const languageTools = ace.require('ace/ext/language_tools')
22
24
  const customCompleter = {
@@ -25,8 +27,8 @@ class MbgAceEditorController {
25
27
  },
26
28
  }
27
29
  languageTools.addCompleter(customCompleter)
28
- editor.completers = [customCompleter]
29
- editor.setOptions({
30
+ this.editorRef.completers = [customCompleter]
31
+ this.editorRef.setOptions({
30
32
  enableBasicAutocompletion: true,
31
33
  fontSize: '14px',
32
34
  enableSnippets: true,
@@ -39,7 +41,7 @@ class MbgAceEditorController {
39
41
  showGutter: false,
40
42
  highlightActiveLine: false,
41
43
  })
42
- editor.$blockScrolling = Infinity
44
+ this.editorRef.$blockScrolling = Infinity
43
45
  }
44
46
 
45
47
  onLoadEditor = (editor) => {
@@ -55,6 +57,7 @@ const mbgAceEditor = {
55
57
  ngModel: '=',
56
58
  variables: '=?',
57
59
  height: '@?',
60
+ editorRef: '=?',
58
61
  },
59
62
  template,
60
63
  controller: MbgAceEditorController,
package/src/index.html CHANGED
@@ -987,7 +987,10 @@
987
987
  <div class="panel-body">
988
988
  <mbg-ace-editor ng-model="aceEditor"
989
989
  height="104px"
990
+ editor-ref="uiAceRef"
990
991
  variables="uiAceVariables"></mbg-ace-editor>
992
+ <button type="button"
993
+ ng-click="onPastEditor('Teste Label')"> Clique aqui!</button>
991
994
  </div>
992
995
  </div>
993
996
  <div class="panel panel-default">
package/src/index.ts CHANGED
@@ -39,6 +39,8 @@ const module = angular.module('demo', ['ngLocale', components]).controller('demo
39
39
  onSave: (json) => {},
40
40
  }
41
41
 
42
+ $scope.uiAceRef = null
43
+
42
44
  $scope.addEvent = () => {
43
45
  $timeout(() => {
44
46
  $scope.events.push({
@@ -8881,6 +8883,12 @@ const module = angular.module('demo', ['ngLocale', components]).controller('demo
8881
8883
  meta: 'Variável',
8882
8884
  },
8883
8885
  ]
8886
+
8887
+ $scope.onPastEditor = (value) => {
8888
+ if ($scope.uiAceRef) {
8889
+ $scope.uiAceRef.insert(value)
8890
+ }
8891
+ }
8884
8892
  },
8885
8893
  ])
8886
8894
  angular.bootstrap(document, [module.name])