Sha256: 51521e0730cda457c80fb4bd8d7a6778e3a08567b9f14c9d7fd4393d58547b25

Contents?: true

Size: 770 Bytes

Versions: 15

Compression:

Stored size: 770 Bytes

Contents

function codemirrorify(el) {
  return CodeMirror.fromTextArea(el, {
    theme: "neo",
    lineNumbers: true,
    viewportMargin: Infinity,
    mode: "fluentd"
  });
}

$(function(){
  $('.js-fluentd-config-editor').each(function(_, el){
    codemirrorify(el);
  });
});

Vue.directive('config-editor', {
  bind: function(){
    var $parent = this.vm;
    // NOTE: needed delay for waiting CodeMirror setup
    _.delay(function(textarea){
      var cm = codemirrorify(textarea);
      // textarea.codemirror = cm; // for test, but doesn't work for now (working on Chrome, but Poltergeist not)
      cm.on('change', function(code_mirror){
        // bridge Vue - CodeMirror world
        $parent.editContent = code_mirror.getValue();
      });
    }, 0, this.el);
  }
});

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
fluentd-ui-0.4.5 app/assets/javascripts/codemirror.js
fluentd-ui-0.4.4 app/assets/javascripts/codemirror.js
fluentd-ui-0.4.3 app/assets/javascripts/codemirror.js
fluentd-ui-0.4.2 app/assets/javascripts/codemirror.js
fluentd-ui-0.4.1 app/assets/javascripts/codemirror.js
fluentd-ui-0.4.0 app/assets/javascripts/codemirror.js
fluentd-ui-0.3.21 app/assets/javascripts/codemirror.js
fluentd-ui-0.3.20 app/assets/javascripts/codemirror.js
fluentd-ui-0.3.19 app/assets/javascripts/codemirror.js
fluentd-ui-0.3.18 app/assets/javascripts/codemirror.js
fluentd-ui-0.3.17 app/assets/javascripts/codemirror.js
fluentd-ui-0.3.16 app/assets/javascripts/codemirror.js
fluentd-ui-0.3.15 app/assets/javascripts/codemirror.js
fluentd-ui-0.3.14 app/assets/javascripts/codemirror.js
fluentd-ui-0.3.13 app/assets/javascripts/codemirror.js