mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 23:39:41 +02:00
21 lines
629 B
JavaScript
21 lines
629 B
JavaScript
|
angular.module('portainer.app')
|
||
|
.controller('CodeEditorController', ['$document', 'CodeMirrorService',
|
||
|
function ($document, CodeMirrorService) {
|
||
|
var ctrl = this;
|
||
|
|
||
|
this.$onInit = function() {
|
||
|
$document.ready(function() {
|
||
|
var editorElement = $document[0].getElementById(ctrl.identifier);
|
||
|
if (editorElement) {
|
||
|
ctrl.editor = CodeMirrorService.applyCodeMirrorOnElement(editorElement, ctrl.yml, ctrl.readOnly);
|
||
|
if (ctrl.onChange) {
|
||
|
ctrl.editor.on('change', ctrl.onChange);
|
||
|
}
|
||
|
if (ctrl.value) {
|
||
|
ctrl.editor.setValue(ctrl.value);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
}]);
|