feat(core): 主页面添加新配置项 自动恢复上次编辑状态

This commit is contained in:
王立帮
2025-09-24 22:08:03 +08:00
parent b5b2a7422d
commit 851bb60057
8 changed files with 25 additions and 5 deletions

View File

@@ -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();

View File

@@ -656,6 +656,7 @@
"require": [
"path",
"d3",
"Mixly.Config",
"Mixly.Env",
"Mixly.Boards",
"Mixly.App",

View File

@@ -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";

View File

@@ -43,6 +43,9 @@ XML.TEMPLATE_CONFIG = [
language: () => {
return Msg.getLang('LANGUAGE');
},
cache: () => {
return Msg.getLang('CACHE');
},
autoUpdate: () => {
return Msg.getLang('AUTO_CHECK_UPDATE');
},

View File

@@ -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"
}

View File

@@ -79,5 +79,6 @@
"CODE_LANG": "编程语言",
"ENABLE": "开启",
"DISABLE": "关闭",
"EXPERIMENTAL": "实验性。预期行为可能会在未来发生变更。"
"EXPERIMENTAL": "实验性。预期行为可能会在未来发生变更。",
"CACHE": "自动恢复上次编辑状态"
}

View File

@@ -79,5 +79,6 @@
"CODE_LANG": "程式碼語言",
"ENABLE": "開啟",
"DISABLE": "關閉",
"EXPERIMENTAL": "實驗性。 預期行為可能會在未來發生變更。"
"EXPERIMENTAL": "實驗性。 預期行為可能會在未來發生變更。",
"CACHE": "自動恢復上次編輯狀態"
}

View File

@@ -218,6 +218,15 @@
</select>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">{{ d.cache }}</label>
<div class="layui-input-block layui-row layui-col-space10">
<select class="setting-menu-item" value="cache" lay-ignore>
<option value="yes">{{ d.yes }}</option>
<option value="no">{{ d.no }}</option>
</select>
</div>
</div>
{{# if(d.env === 'electron'){ }}
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">{{ d.autoUpdate }}</label>