- Merge request !1Issue #3082195: Support loading ACE editor locally w/o CDN β (Open) created by ruslan piskarov
- πΊπΈUnited States bkosborne New Jersey, USA
Hmm I think it goes beyond just replacing the library path to load from a local version instead of the CDN, because the this module's
asset_injector.ace_editor.js
currently includes the following hardcoded:ace.config.set('basePath', '//cdnjs.cloudflare.com/ajax/libs/ace/1.8.1'); ace.config.set('modePath', '//cdnjs.cloudflare.com/ajax/libs/ace/1.8.1'); ace.config.set('themePath', '//cdnjs.cloudflare.com/ajax/libs/ace/1.8.1');
I think these three lines are only necessary if you're loading it from the CDN. This can probably be solved if we pass down via drupalSettings if the module used the CDN or not to load the main library, and if not, don't run these lines.
- πΊπΈUnited States bkosborne New Jersey, USA
Okay, I was wrong, we need those lines regardless, because without them the library tries to auto-detect the path to those directories and it doesn't work if JS aggregation is turned on.
So, if the ace-builds version of the library is used (and stored locally), we need to provide its path via drupalSettings
- Status changed to Needs review
4 months ago 2:28pm 9 August 2024 - Status changed to Needs work
4 months ago 2:40pm 9 August 2024 - π©πͺGermany Anybody Porta Westfalica
Thanks @tobiasb - the README says
is taken from CDN as long as no min.js file exists
but I can't see related code, what am I missing?
Also see #18 - looks like hook_library_info_alter() and other parts like the tests are still missing?
The referenced issue is a nice template. - π©πͺGermany Anybody Porta Westfalica
- π©πͺGermany danielehrenhofer Frankfurt
Due to our content security policy, loading external resources, e.g. via a CDN, is prohibited. As a result, I have now noticed that ace.js appears to be loading the resource mode-css.js via a CDN: https://cdnjs.cloudflare.com/ajax/libs/ace/1.8.1/mode-css.js
Is this known and can it be prevented somehow?
For better illustration I have added a screenshot of my developer console.