This is an automated email from the ASF dual-hosted git repository. ovilia pushed a commit to branch gh-pages in repository https://gitbox.apache.org/repos/asf/echarts-examples.git
commit 23653000c4eb1a9ec6deea1bc3978ec5c16911b8 Author: Ovilia <zwl.s...@gmail.com> AuthorDate: Wed May 11 16:48:38 2022 +0800 feat: add warning of user-generated url --- src/common/i18n.js | 8 +++++--- src/editor/Editor.vue | 13 +++++++++++++ src/editor/Preview.vue | 13 +++++++++++++ src/editor/View.vue | 16 ++++++++++++++++ 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/src/common/i18n.js b/src/common/i18n.js index 018f24ed..841e79b1 100644 --- a/src/common/i18n.js +++ b/src/common/i18n.js @@ -45,8 +45,9 @@ export default { share: { title: 'Share', - success: 'Sharable URL has been copied to your clipboard' - } + success: 'Sharable URL has been copied to your clipboard', + hint: 'Please be aware that this chart is not an official demo of Apache ECharts but is made by user-generated code.' + }, }, chartTypes: { @@ -137,7 +138,8 @@ export default { share: { title: '分享', - success: '分享链接已复制到剪贴板' + success: '分享链接已复制到剪贴板', + hint: '请注意,该图表不是 Apache ECharts 官方示例,而是由用户代码生成的。请注意鉴别其内容。' } }, diff --git a/src/editor/Editor.vue b/src/editor/Editor.vue index a14442e6..6797a3f0 100644 --- a/src/editor/Editor.vue +++ b/src/editor/Editor.vue @@ -251,6 +251,7 @@ export default { loadExampleCode().then((code) => { // No editor available. Set to runCode directly. store.runCode = parseSourceCode(code); + this.showShareHint(); }); } else { loadExampleCode().then((code) => { @@ -259,6 +260,7 @@ export default { if (store.initialCode !== CODE_CHANGED_FLAG) { store.initialCode = this.initialCode; } + this.showShareHint(); }); window.addEventListener('mousemove', (e) => { @@ -276,6 +278,17 @@ export default { }, methods: { + showShareHint() { + if (store.isSharedCode) { + this.$message.closeAll(); + this.$message({ + type: 'warning', + message: this.$t('editor.share.hint'), + duration: 5000, + showClose: true + }); + } + }, toExternalEditor(vendor) { const previewRef = this.$refs.preview; if (!previewRef) { diff --git a/src/editor/Preview.vue b/src/editor/Preview.vue index ba27a918..2dafe445 100644 --- a/src/editor/Preview.vue +++ b/src/editor/Preview.vue @@ -329,6 +329,9 @@ export default { mounted() { this.run(); + if (store.isSharedCode) { + this.showShareHint(); + } this.fetchVersionList(); }, @@ -412,6 +415,16 @@ export default { (store.renderer === 'svg' ? 'svg' : 'png') ); }, + showShareHint() { + this.$message.closeAll(); + this.$message({ + type: 'warning', + message: this.$t('editor.share.hint'), + customClass: 'toast-shared-url', + duration: 5000, + showClose: true + }); + }, share() { const params = {}; if (store.initialCode !== store.sourceCode) { diff --git a/src/editor/View.vue b/src/editor/View.vue index a8b1ca10..6b436641 100644 --- a/src/editor/View.vue +++ b/src/editor/View.vue @@ -15,6 +15,22 @@ export default { loadExampleCode().then((code) => { store.runCode = parseSourceCode(code); }); + + this.showShareHint(); + }, + + methods: { + showShareHint() { + if (store.isSharedCode) { + this.$message.closeAll(); + this.$message({ + type: 'warning', + message: this.$t('editor.share.hint'), + duration: 5000, + showClose: true + }); + } + } } }; </script> --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org