diff --git a/common/modules/mixly-modules/deps.json b/common/modules/mixly-modules/deps.json index 31533864..6a9aa9a2 100644 --- a/common/modules/mixly-modules/deps.json +++ b/common/modules/mixly-modules/deps.json @@ -1580,6 +1580,7 @@ "path", "Blockly", "Mixly.MFile", + "Mixly.Title", "Mixly.LayerExt", "Mixly.Msg", "Mixly.Workspace" diff --git a/common/modules/mixly-modules/web/file.js b/common/modules/mixly-modules/web/file.js index 3159dba1..cd59ce22 100644 --- a/common/modules/mixly-modules/web/file.js +++ b/common/modules/mixly-modules/web/file.js @@ -3,6 +3,7 @@ goog.loadJs('web', () => { goog.require('path'); goog.require('Blockly'); goog.require('Mixly.MFile'); +goog.require('Mixly.Title'); goog.require('Mixly.LayerExt'); goog.require('Mixly.Msg'); goog.require('Mixly.Workspace'); @@ -51,6 +52,7 @@ File.open = async () => { return; } File.parseData(extname, await fileInfo.text()); + Title.updateTitle(obj.name + ' - ' + Title.title); } catch (error) { console.log(error); } @@ -60,6 +62,7 @@ File.open = async () => { let { data, filename } = fileObj; const extname = path.extname(filename); File.parseData(extname, data); + Title.updateTitle(filename + ' - ' + Title.title); }); } } @@ -131,6 +134,7 @@ File.saveAs = async () => { } File.obj = obj; File.save(); + Title.updateTitle(obj.name + ' - ' + Title.title); } catch (error) { console.log(error); } @@ -148,12 +152,14 @@ File.new = async () => { workspaceToCode = generator.workspaceToCode(blockEditor) || ''; if (!blocksList.length && workspaceToCode === code) { layer.msg(Msg.Lang['代码区已清空'], { time: 1000 }); + Title.updateTitle(Title.title); File.obj = null; return; } } else { if (!blocksList.length) { layer.msg(Msg.Lang['工作区已清空'], { time: 1000 }); + Title.updateTitle(Title.title); File.obj = null; return; } @@ -177,6 +183,7 @@ File.new = async () => { blockEditor.scrollCenter(); Blockly.hideChaff(); codeEditor.setValue(generator.workspaceToCode(blockEditor) || '', -1); + Title.updateTitle(Title.title); File.obj = null; }); }