File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -981,7 +981,8 @@ export const hasCode = () => {
981981 const xml = Blockly . Xml . workspaceToDom ( Blockly . mainWorkspace ) ;
982982 const text = Blockly . Xml . domToText ( xml ) ;
983983 const emptyHeader = Project . getTerminatedEmptyProjectCodeHeader ( ) ;
984- if ( text !== emptyHeader ) {
984+ const emptyHeaderV2 = Project . getTerminatedEmptyProjectCodeHeaderV2 ( ) ;
985+ if ( ! ( text === emptyHeader || text === emptyHeaderV2 ) ) {
985986 result = true ;
986987 }
987988 }
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import {logConsoleMessage} from './utility';
3535 */
3636const EmptyProjectCodeHeader = '<xml xmlns="https://developers.google.com/blockly/xml">' ;
3737const TerminatedEmptyProjectCodeHeader = '<xml xmlns="https://developers.google.com/blockly/xml"/>' ;
38+ const TerminatedEmptyProjectCodeHeaderV2 = `<xml xmlns=\"https://developers.google.com/blockly/xml\"></xml>` ;
3839
3940/**
4041 * Preserve the initial state of the project
@@ -386,6 +387,14 @@ class Project {
386387 return TerminatedEmptyProjectCodeHeader ;
387388 }
388389
390+ /**
391+ * Version 2 empty project string
392+ * @return {string }
393+ */
394+ static getTerminatedEmptyProjectCodeHeaderV2 ( ) {
395+ return TerminatedEmptyProjectCodeHeaderV2 ;
396+ }
397+
389398 /**
390399 * Convert a string project board type
391400 * @param {string } board
Original file line number Diff line number Diff line change 2323import { hasCode } from './blocklyc' ;
2424import { getProjectInitialState } from './project.js' ;
2525import { clientService , serviceConnectionTypes } from './client_service' ;
26+ import { logConsoleMessage } from "./utility" ;
2627
2728
2829/**
@@ -55,6 +56,9 @@ export function propToolbarButtonController() {
5556 disableButtons ( false , isS3boardType ) ;
5657 return ;
5758 }
59+ else {
60+ console . log ( `Project has code` ) ;
61+ }
5862 }
5963 // The compile button should always be available when a project
6064 // is loaded and there is at least one block defined in the project
You can’t perform that action at this time.
0 commit comments