Skip to content

Commit

Permalink
blockly plugin: refix code
Browse files Browse the repository at this point in the history
  • Loading branch information
onkelandy committed Oct 24, 2023
1 parent 634dcc1 commit 8d165db
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions blockly/webif/static/js/logics_blockly_code.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ Code.loadBlocks = function() {
Code.renderContent = function() {
//if (Code.selected == 'python') {
var content = document.getElementById('content_python');
//pycode = Blockly.Python.workspaceToCode(Code.workspace);
var pycode = Blockly.Python.forBlock[Code.workspace];
var pycode = Blockly.Python.workspaceToCode(Code.workspace);
content.textContent = pycode;
if (typeof prettyPrintOne == 'function') {
pycode = content.innerHTML;
Expand All @@ -71,13 +70,13 @@ Code.wait = function (ms){
Code.saveBlocks = function() {
var logicname = "";
var topblock = Code.workspace.getTopBlocks()[0];

if (topblock.data == "sh_logic_main") {
logicname = Code.workspace.getTopBlocks()[0].getFieldValue('LOGIC_NAME')
};
//Code.workspace;
//var pycode = Blockly.Python.workspaceToCode(Code.workspace);
var pycode = Blockly.Python.forBlock[Code.workspace];
var xmldom = Blockly.utils.xml.workspaceToDom(Code.workspace);
var pycode = Blockly.Python.workspaceToCode(Code.workspace);
var xmldom = Blockly.Xml.workspaceToDom(Code.workspace);
var xmltxt = Blockly.utils.xml.domToText(xmldom);

$.ajax({ url: "blockly_save_logic",
Expand Down

0 comments on commit 8d165db

Please sign in to comment.