diff --git a/common/modules/mixly-modules/common/editor-blockly.js b/common/modules/mixly-modules/common/editor-blockly.js index 64703f24..02b12c7d 100644 --- a/common/modules/mixly-modules/common/editor-blockly.js +++ b/common/modules/mixly-modules/common/editor-blockly.js @@ -181,6 +181,10 @@ class EditorBlockly extends EditorBase { return $xml[0].outerHTML; } + this.getRawCode = (workspace, generator) => { + return generator?.workspaceToCode(workspace) || ''; + } + this.getCode = (workspace, generator) => { let code = generator?.workspaceToCode(workspace) || ''; code = code.replace(/(_E[0-9A-F]{1}_[0-9A-F]{2}_[0-9A-F]{2})+/g, function (s) { @@ -327,6 +331,11 @@ class EditorBlockly extends EditorBase { return EditorBlockly.getXML(workspace); } + getRawCode() { + const workspace = this.#getTargetWorkspace_(); + return EditorBlockly.getRawCode(workspace, Blockly.generator); + } + getCode() { const workspace = this.#getTargetWorkspace_(); return EditorBlockly.getCode(workspace, Blockly.generator); diff --git a/common/modules/mixly-modules/common/editor-mix.js b/common/modules/mixly-modules/common/editor-mix.js index 7c668220..53c7d348 100644 --- a/common/modules/mixly-modules/common/editor-mix.js +++ b/common/modules/mixly-modules/common/editor-mix.js @@ -458,8 +458,8 @@ class EditorMix extends EditorBase { getCode() { const blockPage = this.getPage('block'); const codePage = this.getPage('code'); - if (this.drag.shown === Drag.Extend.POSITIVE) { - return blockPage.getCode(); + if (this.drag.shown !== Drag.Extend.NEGATIVE) { + return blockPage.getRawCode(); } else { return codePage.getCode(); }