ui-ace icon indicating copy to clipboard operation
ui-ace copied to clipboard

Access to ace.config

Open alex6o opened this issue 10 years ago • 6 comments

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");

alex6o avatar Apr 29 '14 13:04 alex6o

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

mren avatar May 15 '14 08:05 mren

@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?

arunkjn avatar Jul 21 '14 12:07 arunkjn

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

EmmanuelDemey avatar Aug 01 '14 13:08 EmmanuelDemey

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

arunkjn avatar Aug 01 '14 19:08 arunkjn

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

danfinnie avatar Oct 29 '14 21:10 danfinnie

@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 :)

kazoompa avatar Jun 11 '15 14:06 kazoompa