diff --git a/core/block_svg.js b/core/block_svg.js
index 505da905a..47cee2673 100644
--- a/core/block_svg.js
+++ b/core/block_svg.js
@@ -629,7 +629,7 @@ Blockly.BlockSvg.prototype.onMouseDown_ = function(e) {
Blockly.BlockSvg.prototype.showHelp_ = function() {
var url = (typeof this.helpUrl == 'function') ? this.helpUrl() : this.helpUrl;
if (url) {
- open(url);
+ window.open(url);
}
};
diff --git a/core/events.js b/core/events.js
index 41f247f2f..285c9d45c 100644
--- a/core/events.js
+++ b/core/events.js
@@ -411,7 +411,8 @@ Blockly.Events.disableOrphans = function(event) {
var workspace = Blockly.Workspace.getById(event.workspaceId);
var block = workspace.getBlockById(event.blockId);
if (block) {
- if (block.getParent() && !block.getParent().disabled) {
+ var parent = block.getParent()
+ if (parent && parent.isEnabled()) {
var children = block.getDescendants(false);
for (var i = 0, child; child = children[i]; i++) {
child.setEnabled(true);
diff --git a/core/flyout_base.js b/core/flyout_base.js
index b651f7255..c8fcc79d2 100644
--- a/core/flyout_base.js
+++ b/core/flyout_base.js
@@ -455,7 +455,7 @@ Blockly.Flyout.prototype.show = function(xmlList) {
switch (xml.tagName.toUpperCase()) {
case 'BLOCK':
var curBlock = Blockly.Xml.domToBlock(xml, this.workspace_);
- if (curBlock.disabled) {
+ if (!curBlock.isEnabled()) {
// Record blocks that were initially disabled.
// Do not enable these blocks as a result of capacity filtering.
this.permanentlyDisabled_.push(curBlock);
@@ -612,7 +612,7 @@ Blockly.Flyout.prototype.onMouseDown_ = function(e) {
* @package
*/
Blockly.Flyout.prototype.isBlockCreatable_ = function(block) {
- return !block.disabled;
+ return block.isEnabled();
};
/**
diff --git a/core/generator.js b/core/generator.js
index fc59214c1..4241e2440 100644
--- a/core/generator.js
+++ b/core/generator.js
@@ -182,7 +182,7 @@ Blockly.Generator.prototype.blockToCode = function(block, opt_thisOnly) {
if (!block) {
return '';
}
- if (block.disabled) {
+ if (!block.isEnabled()) {
// Skip past this block if it is disabled.
return opt_thisOnly ? '' : this.blockToCode(block.getNextBlock());
}
diff --git a/core/gesture.js b/core/gesture.js
index 9023b272f..4e18a1204 100644
--- a/core/gesture.js
+++ b/core/gesture.js
@@ -734,7 +734,7 @@ Blockly.Gesture.prototype.doFieldClick_ = function() {
Blockly.Gesture.prototype.doBlockClick_ = function() {
// Block click in an autoclosing flyout.
if (this.flyout_ && this.flyout_.autoClose) {
- if (!this.targetBlock_.disabled) {
+ if (this.targetBlock_.isEnabled()) {
if (!Blockly.Events.getGroup()) {
Blockly.Events.setGroup(true);
}
diff --git a/core/workspace_svg.js b/core/workspace_svg.js
index 7f20dca13..f07cdc5f2 100644
--- a/core/workspace_svg.js
+++ b/core/workspace_svg.js
@@ -272,6 +272,21 @@ Blockly.WorkspaceSvg.prototype.trashcan = null;
*/
Blockly.WorkspaceSvg.prototype.scrollbar = null;
+/**
+ * Fixed flyout providing blocks which may be dragged into this workspace.
+ * @type {Blockly.Flyout}
+ * @private
+ */
+Blockly.WorkspaceSvg.prototype.flyout_ = null;
+
+/**
+ * Category-based toolbox providing blocks which may be dragged into this
+ * workspace.
+ * @type {Blockly.Toolbox}
+ * @private
+ */
+Blockly.WorkspaceSvg.prototype.toolbox_ = null;
+
/**
* The current gesture in progress on this workspace, if any.
* @type {Blockly.TouchGesture}
@@ -533,10 +548,6 @@ Blockly.WorkspaceSvg.prototype.createDom = function(opt_backgroundClass) {
// Determine if there needs to be a category tree, or a simple list of
// blocks. This cannot be changed later, since the UI is very different.
if (this.options.hasCategories) {
- /**
- * @type {Blockly.Toolbox}
- * @private
- */
this.toolbox_ = new Blockly.Toolbox(this);
}
if (this.grid_) {
@@ -660,11 +671,6 @@ Blockly.WorkspaceSvg.prototype.addFlyout_ = function(tagName) {
horizontalLayout: this.horizontalLayout,
toolboxPosition: this.options.toolboxPosition
};
- /**
- * @type {!Blockly.Flyout}
- * @private
- */
- this.flyout_ = null;
if (this.horizontalLayout) {
this.flyout_ = new Blockly.HorizontalFlyout(workspaceOptions);
} else {
@@ -672,7 +678,7 @@ Blockly.WorkspaceSvg.prototype.addFlyout_ = function(tagName) {
}
this.flyout_.autoClose = false;
- // Return the element so that callers can place it in their desired
+ // Return the element so that callers can place it in their desired
// spot in the DOM. For example, mutator flyouts do not go in the same place
// as main workspace flyouts.
return this.flyout_.createDom(tagName);
diff --git a/core/xml.js b/core/xml.js
index 3c03c0c64..eb736afaf 100644
--- a/core/xml.js
+++ b/core/xml.js
@@ -206,7 +206,7 @@ Blockly.Xml.blockToDom = function(block, opt_noId) {
if (block.isCollapsed()) {
element.setAttribute('collapsed', true);
}
- if (block.disabled) {
+ if (!block.isEnabled()) {
element.setAttribute('disabled', true);
}
if (!block.isDeletable() && !block.isShadow()) {
@@ -350,11 +350,13 @@ Blockly.Xml.clearWorkspaceAndLoadFromXml = function(xml, workspace) {
* Decode an XML DOM and create blocks on the workspace.
* @param {!Element} xml XML DOM.
* @param {!Blockly.Workspace} workspace The workspace.
- * @return {Array. To run this test manually, download
closure-compiler-vxxxxxxxx.jar,
- place it in this directory, then run compile.js from the command line.
Measure the size of main_compressed.js (295kb as of October 2017), then reload this page and see if Blockly works.