This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch gh-pages
in repository https://gitbox.apache.org/repos/asf/echarts-examples.git


The following commit(s) were added to refs/heads/gh-pages by this push:
     new d908a889 fix ts csp issue
d908a889 is described below

commit d908a88933d24886b8eb6c8efef81f44370a3e4d
Author: pissang <[email protected]>
AuthorDate: Tue Feb 4 22:34:38 2025 +0800

    fix ts csp issue
---
 src/editor/CodeMonaco.vue | 16 +++++++++-------
 src/editor/Preview.vue    |  4 +++-
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/editor/CodeMonaco.vue b/src/editor/CodeMonaco.vue
index fbfb4402..b3a33ad1 100644
--- a/src/editor/CodeMonaco.vue
+++ b/src/editor/CodeMonaco.vue
@@ -9,15 +9,17 @@ import { URL_PARAMS, getScriptURLs } from '../common/config';
 
 function loadTypes() {
   const SCRIPT_URLS = getScriptURLs(store.locale);
+  const isLocal = 'local' in URL_PARAMS;
 
   return fetch(
-    ('local' in URL_PARAMS
-      ? SCRIPT_URLS.localEChartsDir
-      : SCRIPT_URLS[
-          store.echartsVersion.indexOf('dev') > -1
-            ? 'echartsNightlyDir'
-            : 'echartsDir'
-        ].replace('{{version}}', store.echartsVersion)) +
+    // ('local' in URL_PARAMS
+    //   ? SCRIPT_URLS.localEChartsDir
+    //   : SCRIPT_URLS[
+    //       store.echartsVersion.indexOf('dev') > -1
+    //         ? 'echartsNightlyDir'
+    //         : 'echartsDir'
+    //     ].replace('{{version}}', store.echartsVersion))
+    (isLocal ? SCRIPT_URLS.localEChartsDir : SCRIPT_URLS.latestEChartsDir) +
       '/types/dist/echarts.d.ts',
     {
       mode: 'cors'
diff --git a/src/editor/Preview.vue b/src/editor/Preview.vue
index 8b7d3332..973df36c 100644
--- a/src/editor/Preview.vue
+++ b/src/editor/Preview.vue
@@ -191,7 +191,9 @@ function getScripts(nightly) {
   // const echartsDir = store.isPR
   //   ? echartsDirTpl.replace('{{PR_NUMBER}}', store.prNumber)
   //   : echartsDirTpl.replace('{{version}}', store.echartsVersion);
-  const echartsDir = SCRIPT_URLS.latestEChartsDir;
+  const echartsDir = isLocal
+    ? SCRIPT_URLS.localEChartsDir
+    : SCRIPT_URLS.latestEChartsDir;
 
   const code = store.runCode;
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to