panweitong hace 3 años
padre
commit
f4db1a0f2f
Se han modificado 3 ficheros con 3 adiciones y 3 borrados
  1. 1 1
      python/src/toolbar.js
  2. 1 1
      src/blockly/ardublockly.js
  3. 1 1
      src/toolbar.js

+ 1 - 1
python/src/toolbar.js

@@ -185,7 +185,7 @@ BlockPyToolbar.prototype.activateToolbar = function () {
         var _xml = blockpy.components.editor.getBlocksFromXml();
         _xml.setAttribute("type", $("#mode")[0].selectedIndex == 1 ? "AI" : "IoT")
         var data = Blockly.Xml.domToPrettyText(_xml);
-        let filename = $('#sketch_name').val();
+        let filename = $("#sketch_name").val() != '' ? $("#sketch_name").val() : "未命名";
         let reg = new RegExp(/[^a-z0-9]/)
 
 

+ 1 - 1
src/blockly/ardublockly.js

@@ -73,7 +73,7 @@ Ardublockly.bindActionFunctions = function () {
         $("#Storage_export_modal").modal("close");
     });
     Ardublockly.bindClick_('workspace_screenshot', () => {
-        let name = $("#sketch_name").val();
+        let name = $("#sketch_name").val() != '' ? $("#sketch_name").val() : "未命名";
         Ardublockly.workspace_capture(name);
         Materialize.toast('截图已经保存至"下载"', 3000, 'shareUrl');
     });

+ 1 - 1
src/toolbar.js

@@ -185,7 +185,7 @@ BlockPyToolbar.prototype.activateToolbar = function () {
         var _xml = blockpy.components.editor.getBlocksFromXml();
         _xml.setAttribute("type", $("#mode")[0].selectedIndex == 1 ? "AI" : "IoT")
         var data = Blockly.Xml.domToPrettyText(_xml);
-        let filename = $('#sketch_name').val();
+        let filename = $("#sketch_name").val() != '' ? $("#sketch_name").val() : "未命名";
         let reg = new RegExp(/[^a-z0-9]/)