From f61ba931302a8cf656511bb678683eadb8e76d34 Mon Sep 17 00:00:00 2001 From: jmfrancois Date: Mon, 24 Jul 2023 17:06:28 +0200 Subject: [PATCH] fix: make it works without timeout --- .changeset/clever-snails-whisper.md | 5 +++++ fork/module-to-cdn/modules.json | 8 ++++++++ .../forms/src/UIForm/fields/Code/Code.component.tsx | 10 +++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 .changeset/clever-snails-whisper.md diff --git a/.changeset/clever-snails-whisper.md b/.changeset/clever-snails-whisper.md new file mode 100644 index 00000000000..fe4c03d9414 --- /dev/null +++ b/.changeset/clever-snails-whisper.md @@ -0,0 +1,5 @@ +--- +'@talend/module-to-cdn': minor +--- + +feat: add ace-builds diff --git a/fork/module-to-cdn/modules.json b/fork/module-to-cdn/modules.json index a2054af34ba..a7907108c24 100644 --- a/fork/module-to-cdn/modules.json +++ b/fork/module-to-cdn/modules.json @@ -155,6 +155,14 @@ } } }, + "ace-builds": { + "versions": { + ">= 1.10.1": { + "development": "/", + "production": "/" + } + } + }, "aframe": { "var": "AFRAME", "versions": { diff --git a/packages/forms/src/UIForm/fields/Code/Code.component.tsx b/packages/forms/src/UIForm/fields/Code/Code.component.tsx index 3342eeed9d5..f7e3c11927f 100644 --- a/packages/forms/src/UIForm/fields/Code/Code.component.tsx +++ b/packages/forms/src/UIForm/fields/Code/Code.component.tsx @@ -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); }); }),