Open SparkFountain opened 5 years ago
Not sure for what you need that. Its more of an question how to do that with Brace. Due to way the Brace works you just import the modes and themes in your code and after that it works. Just see the code for an example.
I join the question. I need to dynamically update the mode as the syntax may change.
Example app has mode switching function so check that for how to change mode.
What worked for me was
import * as ace from 'ace-builds';
constructor(private zone: NgZone, @Inject(ENV_ADMIN_BASE_TOKEN) private adminBase: string) {
const assetsPath: string = `${this.adminBase}/assets/ace`; // Path is set in angular.json `assets` output
this.zone.runOutsideAngular(() => {
ace.config.set('basePath', assetsPath);
ace.config.set('modePath', assetsPath);
ace.config.set('themePath', assetsPath);
ace.config.set('workerPath', assetsPath);
});
}
and in angular.json
"architect": {
"build": {
"options": {
"assets": [
"src/assets",
{
"glob": "@(mode-*)",
"input": "node_modules/ace-builds/src-min-noconflict",
"output": "/assets/ace/"
},
{
"glob": "@(ext-modelist|ext-searchbox|theme-eclipse|worker-javascript).js",
"input": "node_modules/ace-builds/src-min-noconflict",
"output": "/assets/ace/"
}
],
}
}
}
Is there a way to define custom paths for themes and modes? I know that with the original Ace library, you can just access the property
ace.config
to overwrite path properties likebasePath
,themePath
andmodePath
. Unfortunately, it seems to be impossible to access or overwrite theconfig
property of the Ace instance; even though the ngx-ace-wrapper documentation says it would allow for full API access through theace()
method on the directive reference.Please tell me if I overlooked something or whether it is possible to change i. e. the modePath at all. Right now, I can only achieve this by editing the
index.js
file of ngx-ace-wrapper (relevant lines are 4082 - 4090) but I would like to avoid changing dependency files...Thank you for your help!