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

Add basePath option in a non-breaking way #167

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ This should be the folder on disk where `ace.js` resides.
workerPath: '/path/to/ace/folder'
}"></div>
```
You could also set the `basePath` option, which will force ace to look for all workers and themes in the folder you specify.

```html
<div ui-ace="{
basePath: '/path/to/ace/workers-and-themes'
}"></div>
```
Please note that ace requests workers and themes dynamically, so bundling them and referencing the bundle using `basePath` doesn't work.

### Working with ng-model

Expand Down
13 changes: 9 additions & 4 deletions src/ui-ace.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,16 @@ angular.module('ui.ace', [])
*/
var setOptions = function(acee, session, opts) {

// sets the ace worker path, if running from concatenated
// or minified source
if (angular.isDefined(opts.workerPath)) {
// sets the ace base and/or worker path,
// if running from concatenated or minified source
if (angular.isDefined(opts.workerPath) || angular.isDefined(opts.basePath)) {
var config = window.ace.require('ace/config');
config.set('workerPath', opts.workerPath);
if (angular.isDefined(opts.basePath)) {
config.set('basePath', opts.basePath);
}
if (angular.isDefined(opts.workerPath)) {
config.set('workerPath', opts.workerPath);
}
}
// ace requires loading
if (angular.isDefined(opts.require)) {
Expand Down