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