Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Features/provide custom ace function #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/ui-ace.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ angular.module('ui.ace', [])
.constant('uiAceConfig', {})
.directive('uiAce', ['uiAceConfig', function (uiAceConfig) {

if (angular.isUndefined(window.ace)) {
throw new Error('ui-ace need ace to work... (o rly?)');
}

/**
* Sets editor options such as the wrapping mode or the syntax checker.
*
Expand Down Expand Up @@ -95,11 +91,22 @@ angular.module('ui.ace', [])
*/
var opts = angular.extend({}, options, scope.$eval(attrs.uiAce));

/**
* ACE library reference
* Use our own "ace" reference or use the global one.
* @type object
*/
var ace = opts.ace || window.ace;

if (!ace) {
throw new Error('ui-ace need ace to work... (o rly?)');
}

/**
* ACE editor
* @type object
*/
var acee = window.ace.edit(elm[0]);
var acee = ace.edit(elm[0]);

/**
* ACE editor session.
Expand Down