From 3891a185efe2b2025eb7b79d89bcacbfb98afb5d Mon Sep 17 00:00:00 2001 From: "Evan W. Patton" Date: Tue, 31 Jan 2017 10:50:07 -0500 Subject: [PATCH] [WIP] Fix element reordering without canvas --- core/block_svg.js | 2 +- core/xml.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/block_svg.js b/core/block_svg.js index 0b0382e10..cf57dfb7e 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -292,7 +292,7 @@ Blockly.BlockSvg.prototype.setParent = function(newParent) { return; } var svgRoot = this.getSvgRoot(); - if (this.parentBlock_ && svgRoot) { + if (this.parentBlock_ && svgRoot && this.workspace.getCanvas()) { // Move this block up the DOM. Keep track of x/y translations. var xy = this.getRelativeToSurfaceXY(); this.workspace.getCanvas().appendChild(svgRoot); diff --git a/core/xml.js b/core/xml.js index 9f4ec2d31..9700ca92a 100644 --- a/core/xml.js +++ b/core/xml.js @@ -417,12 +417,12 @@ Blockly.Xml.domToBlockHeadless_ = function(xmlBlock, workspace) { // Custom data for an advanced block. if (block.domToMutation) { block.domToMutation(xmlChild); - /* disabling due to this being _headless_ + /* disabling due to this being _headless_ if (block.initSvg) { // Mutation may have added some elements that need initalizing. block.initSvg(); } - */ + */ } break; case 'comment':