You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2022/08/04 02:02:28 UTC

[echarts-examples] branch gh-pages updated: fix(editor): fix wrong encoder when sharing the modified base64 code

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

wangzx 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 9785d664 fix(editor): fix wrong encoder when sharing the modified base64 code
9785d664 is described below

commit 9785d6649aab6afd8c9770e90186a1383860663f
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Thu Aug 4 10:01:19 2022 +0800

    fix(editor): fix wrong encoder when sharing the modified base64 code
---
 src/common/helper.js   | 4 +++-
 src/common/store.js    | 1 +
 src/editor/Preview.vue | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/common/helper.js b/src/common/helper.js
index 8b5a142b..4836af2e 100644
--- a/src/common/helper.js
+++ b/src/common/helper.js
@@ -118,7 +118,9 @@ export function isTrustedOpener() {
     return (
       window.opener && window.opener.origin === 'https://echarts.apache.org'
     );
-  } catch {}
+  } catch {
+    // CORS
+  }
 }
 
 export function decodeBase64(str) {
diff --git a/src/common/store.js b/src/common/store.js
index 346e39aa..9c42754b 100644
--- a/src/common/store.js
+++ b/src/common/store.js
@@ -118,6 +118,7 @@ export function loadExampleCode() {
     if (code) {
       try {
         // PENDING fallback to `c` if the decompressed code is not available?
+        // TODO: auto-detect the encoder type?
         code =
           URL_PARAMS.enc === 'base64'
             ? decodeBase64(code)
diff --git a/src/editor/Preview.vue b/src/editor/Preview.vue
index 71cf4add..0202f9cf 100644
--- a/src/editor/Preview.vue
+++ b/src/editor/Preview.vue
@@ -444,6 +444,7 @@ export default {
       const params = {};
       if (store.initialCode !== store.sourceCode) {
         params.code = compressStr(store.sourceCode);
+        params.enc = null;
       }
       return getURL(
         {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org