Sha256: 5c89a0d4b9f92b119e9faf0822dac9ef64ca0a4d216242d655274e078e5ad831

Contents?: true

Size: 1.09 KB

Versions: 32

Compression:

Stored size: 1.09 KB

Contents

!(function (angular) {
  'use strict';

  class AceSnippetManager {
    constructor() {
      this._context = 'pgsql';
      this._aceSnippetManager = ace.require('ace/snippets').snippetManager;
    }

    set context(c) {
      this._context = c;
    }

    get context() {
      return this._context;
    }

    add(name, content) {
      this._aceSnippetManager.register(this._parseSnippet(name, content), this._context);
    }

    remove(name, content) {
      this._aceSnippetManager.unregister(this._parseSnippet(name, content), this._context);
    }

    reset() {
      this._aceSnippetManager.snippetMap = {};
      this._aceSnippetManager.snippetNameMap = {};
    }

    // private method

    _parseSnippet(name, content) {
      let composed = 'snippet ' + name + ' \n\t ' + this._transformNewlines(content);
      return this._aceSnippetManager.parseSnippetFile(composed);
    }

    _transformNewlines(content) {
      return content.replace(/(\r\n|\n|\r)/gm, '\n\t');
    }
  }

  angular.module('alephServices.aceSnippetManager', []).service('AceSnippetManager', AceSnippetManager);
}(angular));

Version data entries

32 entries across 16 versions & 1 rubygems

Version Path
aleph_analytics-0.4.9.pre.dev public/assets/angular/services/snippet/ace_snippet_manager.js-dbbba5d8ad5040042b469b294c4d7228.es6
aleph_analytics-0.4.9.pre.dev app/assets/javascripts/angular/services/snippet/ace_snippet_manager.js.es6
aleph_analytics-0.4.8 public/assets/angular/services/snippet/ace_snippet_manager.js-dbbba5d8ad5040042b469b294c4d7228.es6
aleph_analytics-0.4.8 app/assets/javascripts/angular/services/snippet/ace_snippet_manager.js.es6
aleph_analytics-0.4.7 app/assets/javascripts/angular/services/snippet/ace_snippet_manager.js.es6
aleph_analytics-0.4.7 public/assets/angular/services/snippet/ace_snippet_manager.js-dbbba5d8ad5040042b469b294c4d7228.es6
aleph_analytics-0.4.4 public/assets/angular/services/snippet/ace_snippet_manager.js-dbbba5d8ad5040042b469b294c4d7228.es6
aleph_analytics-0.4.4 app/assets/javascripts/angular/services/snippet/ace_snippet_manager.js.es6
aleph_analytics-0.4.2 public/assets/angular/services/snippet/ace_snippet_manager.js-dbbba5d8ad5040042b469b294c4d7228.es6
aleph_analytics-0.4.2 app/assets/javascripts/angular/services/snippet/ace_snippet_manager.js.es6
aleph_analytics-0.4.1 public/assets/angular/services/snippet/ace_snippet_manager.js-dbbba5d8ad5040042b469b294c4d7228.es6
aleph_analytics-0.4.1 app/assets/javascripts/angular/services/snippet/ace_snippet_manager.js.es6
aleph_analytics-0.3.0 public/assets/angular/services/snippet/ace_snippet_manager.js-dbbba5d8ad5040042b469b294c4d7228.es6
aleph_analytics-0.3.0 app/assets/javascripts/angular/services/snippet/ace_snippet_manager.js.es6
aleph_analytics-0.2.0 app/assets/javascripts/angular/services/snippet/ace_snippet_manager.js.es6
aleph_analytics-0.2.0 public/assets/angular/services/snippet/ace_snippet_manager.js-dbbba5d8ad5040042b469b294c4d7228.es6
aleph_analytics-0.1.0 public/assets/angular/services/snippet/ace_snippet_manager.js-dbbba5d8ad5040042b469b294c4d7228.es6
aleph_analytics-0.1.0 app/assets/javascripts/angular/services/snippet/ace_snippet_manager.js.es6
aleph_analytics-0.0.6 public/assets/angular/services/snippet/ace_snippet_manager.js-dbbba5d8ad5040042b469b294c4d7228.es6
aleph_analytics-0.0.6 app/assets/javascripts/angular/services/snippet/ace_snippet_manager.js.es6