From 851bb60057600318558c37c00e86594c356031f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=AB=8B=E5=B8=AE?= <3294713004@qq.com> Date: Wed, 24 Sep 2025 22:08:03 +0800 Subject: [PATCH] =?UTF-8?q?feat(core):=20=E4=B8=BB=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=B0=E9=85=8D=E7=BD=AE=E9=A1=B9=20`?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=81=A2=E5=A4=8D=E4=B8=8A=E6=AC=A1=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E7=8A=B6=E6=80=81`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/modules/mixly-modules/common/loader.js | 6 +++++- common/modules/mixly-modules/deps.json | 1 + common/msg/blockly/en.js | 2 +- mixly-sw/mixly-modules/common/xml.js | 3 +++ mixly-sw/msg/en.json | 3 ++- mixly-sw/msg/zh-hans.json | 3 ++- mixly-sw/msg/zh-hant.json | 3 ++- mixly-sw/templete/setting-div.html | 9 +++++++++ 8 files changed, 25 insertions(+), 5 deletions(-) diff --git a/common/modules/mixly-modules/common/loader.js b/common/modules/mixly-modules/common/loader.js index a99ce278..6163d903 100644 --- a/common/modules/mixly-modules/common/loader.js +++ b/common/modules/mixly-modules/common/loader.js @@ -2,6 +2,7 @@ goog.loadJs('common', () => { goog.require('path'); goog.require('d3'); +goog.require('Mixly.Config'); goog.require('Mixly.Env'); goog.require('Mixly.Boards'); goog.require('Mixly.App'); @@ -41,6 +42,7 @@ const { } = Mixly; const { LibManager, File } = goog.isElectron? Electron : Web; +const { USER } = Config; window.addEventListener('load', () => { @@ -107,7 +109,9 @@ Loader.init = () => { Mixly.app.getNav().resize(); const workspace = Mixly.app.getWorkspace(); const editor = workspace.getEditorsManager().getActive(); - Loader.restoreBlocks(editor); + if (USER.cache !== 'no') { + Loader.restoreBlocks(editor); + } Mixly.app.removeSkeleton(); window.addEventListener('unload', () => Loader.backupBlocks(editor), false); API2.init(); diff --git a/common/modules/mixly-modules/deps.json b/common/modules/mixly-modules/deps.json index ee5ffc1b..402e4114 100644 --- a/common/modules/mixly-modules/deps.json +++ b/common/modules/mixly-modules/deps.json @@ -656,6 +656,7 @@ "require": [ "path", "d3", + "Mixly.Config", "Mixly.Env", "Mixly.Boards", "Mixly.App", diff --git a/common/msg/blockly/en.js b/common/msg/blockly/en.js index 8f66a32a..7e553f4e 100644 --- a/common/msg/blockly/en.js +++ b/common/msg/blockly/en.js @@ -2140,7 +2140,7 @@ En.MIXLY_ESP32_SERVO_SPEED_TOOLIPS = 'Set the rotation speed of the servo(-100~1 En.MIXLY_ESP32_LED_SETONOFF = "Set the status of the embedded LED light"; En.MIXLY_ESP32_LED_GETONOFF = "Get the current status of the embedded LED light"; En.MIXLY_ESP32_LED_SETBRIGHT = "Set the current brightness of the embedded LED light (0 ~ 1023)"; -En.ZhHans.MIXLY_ESP32_LED_GETBRIGHT = "Get the current brightness of the embedded LED light (0 ~ 1023)"; +En.MIXLY_ESP32_LED_GETBRIGHT = "Get the current brightness of the embedded LED light (0 ~ 1023)"; En.MIXLY_ESP32_MUSIC_PLAYSHOW = "Play the note list and display the corresponding note"; En.MIXLY_ESP32_MUSIC_SET_TEMPO = "Set the resolution and speed of playing music"; En.MIXLY_ESP32_MUSIC_GET_TEMPO = "Get the current rhythm of the music"; diff --git a/mixly-sw/mixly-modules/common/xml.js b/mixly-sw/mixly-modules/common/xml.js index 0afe7f1c..cb763206 100644 --- a/mixly-sw/mixly-modules/common/xml.js +++ b/mixly-sw/mixly-modules/common/xml.js @@ -43,6 +43,9 @@ XML.TEMPLATE_CONFIG = [ language: () => { return Msg.getLang('LANGUAGE'); }, + cache: () => { + return Msg.getLang('CACHE'); + }, autoUpdate: () => { return Msg.getLang('AUTO_CHECK_UPDATE'); }, diff --git a/mixly-sw/msg/en.json b/mixly-sw/msg/en.json index a4bc6cc5..310c62da 100644 --- a/mixly-sw/msg/en.json +++ b/mixly-sw/msg/en.json @@ -79,5 +79,6 @@ "CODE_LANG": "Code language", "ENABLE": "Enable", "DISABLE": "Disable", - "EXPERIMENTAL": "Experimental. Expected behavior may change in the future." + "EXPERIMENTAL": "Experimental. Expected behavior may change in the future.", + "CACHE": "Automatically restore the last editing state" } \ No newline at end of file diff --git a/mixly-sw/msg/zh-hans.json b/mixly-sw/msg/zh-hans.json index d91066a6..09be55c0 100644 --- a/mixly-sw/msg/zh-hans.json +++ b/mixly-sw/msg/zh-hans.json @@ -79,5 +79,6 @@ "CODE_LANG": "编程语言", "ENABLE": "开启", "DISABLE": "关闭", - "EXPERIMENTAL": "实验性。预期行为可能会在未来发生变更。" + "EXPERIMENTAL": "实验性。预期行为可能会在未来发生变更。", + "CACHE": "自动恢复上次编辑状态" } \ No newline at end of file diff --git a/mixly-sw/msg/zh-hant.json b/mixly-sw/msg/zh-hant.json index 41480b94..1444e899 100644 --- a/mixly-sw/msg/zh-hant.json +++ b/mixly-sw/msg/zh-hant.json @@ -79,5 +79,6 @@ "CODE_LANG": "程式碼語言", "ENABLE": "開啟", "DISABLE": "關閉", - "EXPERIMENTAL": "實驗性。 預期行為可能會在未來發生變更。" + "EXPERIMENTAL": "實驗性。 預期行為可能會在未來發生變更。", + "CACHE": "自動恢復上次編輯狀態" } \ No newline at end of file diff --git a/mixly-sw/templete/setting-div.html b/mixly-sw/templete/setting-div.html index 56a3d673..6f3582c2 100644 --- a/mixly-sw/templete/setting-div.html +++ b/mixly-sw/templete/setting-div.html @@ -218,6 +218,15 @@ +