You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/09/02 16:01:39 UTC

[incubator-echarts-doc] branch next updated: fix key generation in patch language

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

shenyi pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts-doc.git


The following commit(s) were added to refs/heads/next by this push:
     new 4c35e65  fix key generation in patch language
4c35e65 is described below

commit 4c35e6516682c50127515f8bc7c1dcea04d5c882
Author: pissang <bm...@gmail.com>
AuthorDate: Thu Sep 3 00:01:23 2020 +0800

    fix key generation in patch language
---
 editor/common/blockHelper.js | 14 ++++++++++----
 tool/patchLanguage.js        |  6 ++++++
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/editor/common/blockHelper.js b/editor/common/blockHelper.js
index 2793941..7e8d32e 100644
--- a/editor/common/blockHelper.js
+++ b/editor/common/blockHelper.js
@@ -185,17 +185,23 @@ module.exports.updateBlocksKeys = function (blocks) {
     const contentKeyCountMap = {};
     const uiControlKeyCountMap = {};
 
+    let scopeKey = stacks.join('.');
+
     for (const block of blocks) {
         let baseKey = '';
-        const scopeKey = stacks.join('.');
         switch (block.type) {
         case 'header':
-            for (let i = block.level; i <= currentLevel; i++) {
-                stacks.pop();
+            if (block.level <= currentLevel) {
+                for (let i = block.level; i <= currentLevel; i++) {
+                    stacks.pop();
+                }
+                stacks.push(block.propertyName);
             }
-            if (block.level >= currentLevel) {
+            else {
                 stacks.push(block.propertyName);
             }
+
+            scopeKey = stacks.join('.');
             baseKey = `header:${scopeKey}`;
             currentLevel = block.level;
             break;
diff --git a/tool/patchLanguage.js b/tool/patchLanguage.js
index 76637f2..09e16d9 100644
--- a/tool/patchLanguage.js
+++ b/tool/patchLanguage.js
@@ -26,6 +26,9 @@ function applyBlocksPatch(fromBlocks, toBlocks) {
         else {
             for (let i = 0; i < part.indices.length; i++) {
                 const fromBlock = fromBlocks[part.indices[i]];
+                // if (fromBlock.key === 'content:top.calendar.splitLine.lineStyle') {
+                //     console.log(part);
+                // }
                 // Just ignore uicontrol block.
                 if (fromBlock.type === 'uicontrol') {
                     continue;
@@ -92,6 +95,9 @@ function applyTargetsPatch(fromJson, toJson) {
             true
         );
         blocksByLang[lang] = json;
+
+        fs.writeFileSync(__dirname + `/blocks-${lang}.json`, JSON.stringify(json, null, 2), 'utf-8');
+
     }
 
     await applyTargetsPatch(blocksByLang[fromLang], blocksByLang[toLang]);


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