Skip to content

Commit

Permalink
fix: make it works without timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
jmfrancois committed Jul 24, 2023
1 parent 90a5019 commit f61ba93
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/clever-snails-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@talend/module-to-cdn': minor
---

feat: add ace-builds
8 changes: 8 additions & 0 deletions fork/module-to-cdn/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@
}
}
},
"ace-builds": {
"versions": {
">= 1.10.1": {
"development": "/",
"production": "/"
}
}
},
"aframe": {
"var": "AFRAME",
"versions": {
Expand Down
10 changes: 7 additions & 3 deletions packages/forms/src/UIForm/fields/Code/Code.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ declare const ace: any;

const ReactAce = lazy(() =>
assetsApi.getUMD('react-ace').then((mod: any) => {
const extUrl = assetsApi.getURL('/src-noconflict/ext-language_tools.js', 'ace-builds');
const extUrl = assetsApi.getURL('/src-min-noconflict/ext-language_tools.js', 'ace-builds');
ace.config.set('basePath', extUrl.replace('ext-language_tools.js', ''));
assetsApi.addScript({ src: extUrl });
// wait for ext-language_tools.js to be loaded before return the ace module
return new Promise(resolve => {
setTimeout(() => {
resolve(assetsApi.toDefaultModule(mod.default));
const cancel = setInterval(() => {
if (ace.require('ace/ext/language_tools')) {
clearInterval(cancel);
debugger;
resolve(assetsApi.toDefaultModule(mod.default));
}
}, 100);
});
}),
Expand Down

0 comments on commit f61ba93

Please sign in to comment.