angular-ui / ui-ace

This directive allows you to add ACE editor elements.
http://angular-ui.github.io/ui-ace
MIT License
578 stars 172 forks source link

Access to ace.config #44

Open alex6o opened 10 years ago

alex6o commented 10 years ago

is it possible to forward options or get access to the ace.config object? in our case we want to modify the basePath option to load themes and mode files from a specific folder

ace.config.set("basePath", "/path/to/src");
mren commented 10 years ago

Yeah, I have the same issue, but with another parameter.

I want to set the minLines and maxLines. According to the documentation you can do this with the onLoad function.

I did

$scope.onLoad = function(ace) {
  ace.setOptions({
    minLines: 10,
    maxLines: 40,
  });
};

which works.

However you have to do this in every controller you use which can get tedious. It would be nice to define this behaviour within the directives options.

It would be nice to have a more generalized way to set the options from within the views. @mrmuh, have you already thought about this? It seems to be a problem which occurs quite often in the issues (#35, #33, #31)

Best, Mark

arunkjn commented 10 years ago

@mren The options that you are referring to belongs to editor instance. It is not the same as 'ace' object. And you cannot set the 'basePath' property through it.

@mrmuh I have the same problem. Basically trying to serve the theme and mode files from a different location, as it is proving to be a pain for my build process. Since 'ace' object is available globally, I just tried ace.config.set.... but it seems to not work. Any luck with the issue?

EmmanuelDemey commented 10 years ago

hi

any news about this question ? I have the same problem. I need to load Ace files from a different directory.

Thanks a lot.

Manu

arunkjn commented 10 years ago

I ended up doing this in my app.config block

//setting paths for ace editor dependencies
var defaultPath = ace.config.get('basePath');
// set your path here
var path = defaultPath.indexOf('ace-builds/src-noconflict') == -1 ? './js/ace' : defaultPath; 
ace.config.set('basePath', path);
ace.config.set('modePath', path);
ace.config.set('themePath', path);
ace.config.set('workerPath', path);        

as it needs to be done once per app lifecycle. the above logic is specific to my app. You can initialize path with anything you like

danfinnie commented 9 years ago

@pdemello and I made pull request #70 that addresses @mren's use case.

kazoompa commented 9 years ago

@arunkjn cheers mate, your solution worked and I was able to change theme path, I was hoping that the latest version of the library didn't have these silly restrictions! May be this will be fixed next release... I hope :)