This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-handbook.git
The following commit(s) were added to refs/heads/master by this push:
new 71cd337 put cdn in the asf to avoid csp issue
71cd337 is described below
commit 71cd337c8bf50cb82e64203858c4803c4779ae59
Author: pissang <[email protected]>
AuthorDate: Tue Feb 4 21:47:50 2025 +0800
put cdn in the asf to avoid csp issue
---
components/markdown/Live.vue | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/components/markdown/Live.vue b/components/markdown/Live.vue
index 2fa9bb1..0f0fca4 100644
--- a/components/markdown/Live.vue
+++ b/components/markdown/Live.vue
@@ -39,7 +39,7 @@ import {
ref,
unref,
onMounted,
- onUnmounted
+ onUnmounted,
} from '@vue/composition-api'
import * as base64 from 'js-base64'
import { createSandbox } from '../helper/sandbox'
@@ -49,12 +49,15 @@ declare const echarts: any
function ensureECharts(locale) {
if (typeof echarts === 'undefined') {
- const isCN = locale === 'zh'
- const lib = process.env.NUXT_ENV_DEPLOY === 'asf' ? 'echarts' :
'echarts-nightly'
+ // const isASFDeploy = process.env.NUXT_ENV_DEPLOY === 'asf'
+ // const lib = isASFDeploy ? 'echarts' : 'echarts-nightly'
return loadScriptsAsync([
- isCN
- ?
`https://registry.npmmirror.com/${lib}/latest/files/dist/echarts.min.js`
- : `https://fastly.jsdelivr.net/npm/${lib}@latest/dist/echarts.min.js`
+ // @ts-ignore
+ (window.ECHARTS_WWW_VENDORS_CDN_ROOT ||
+ 'https://fastly.jsdelivr.net/npm/') + 'echarts/dist/echarts.min.js',
+ // isCN
+ // ?
`https://registry.npmmirror.com/${lib}/latest/files/dist/echarts.min.js`
+ // :
`https://fastly.jsdelivr.net/npm/${lib}@latest/dist/echarts.min.js`,
]).then(() => {})
}
return Promise.resolve()
@@ -63,16 +66,16 @@ function ensureECharts(locale) {
export default defineComponent({
components: {
PrismEditor,
- CodeBlockCopyClipboard
+ CodeBlockCopyClipboard,
},
props: {
lang: {
type: String,
- default: 'js'
+ default: 'js',
},
code: {
- type: String
+ type: String,
},
layout: {
@@ -80,17 +83,17 @@ export default defineComponent({
default: 'tb',
validator(value: string) {
return ['lr', 'tb', 'rl', 'bt'].includes(value)
- }
+ },
},
height: {
- type: Number
+ type: Number,
},
readOnly: {
type: Boolean,
- default: false
- }
+ default: false,
+ },
},
setup(props, context) {
@@ -126,7 +129,7 @@ export default defineComponent({
}
const debouncedUpdate = debounce(update, 500, {
- trailing: true
+ trailing: true,
})
watch(innerCode, () => {
@@ -160,9 +163,9 @@ export default defineComponent({
sandbox.pause()
}
}
- }
+ },
}
- }
+ },
})
</script>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]