diff --git a/accessible/field.component.js b/accessible/field.component.js
index b8e7d79be..e10323db7 100644
--- a/accessible/field.component.js
+++ b/accessible/field.component.js
@@ -46,7 +46,8 @@ blocklyApp.FieldComponent = ng.core
diff --git a/accessible/tree.service.js b/accessible/tree.service.js
index 0c463e191..3b41659d9 100644
--- a/accessible/tree.service.js
+++ b/accessible/tree.service.js
@@ -290,6 +290,8 @@ blocklyApp.TreeService = ng.core
break;
} else if (currentNode.tagName == 'INPUT') {
currentNode.focus();
+ this.notificationsService.setStatusMessage(
+ 'Type a value, then press Escape to exit');
break;
} else if (currentNode.tagName == 'LI') {
continue;
diff --git a/core/field_textinput.js b/core/field_textinput.js
index 859244bba..5af8bf9a7 100644
--- a/core/field_textinput.js
+++ b/core/field_textinput.js
@@ -30,6 +30,7 @@ goog.require('Blockly.Field');
goog.require('Blockly.Msg');
goog.require('goog.asserts');
goog.require('goog.dom');
+goog.require('goog.dom.TagName');
goog.require('goog.userAgent');
@@ -124,7 +125,8 @@ Blockly.FieldTextInput.prototype.showEditor_ = function(opt_quietInput) {
Blockly.WidgetDiv.show(this, this.sourceBlock_.RTL, this.widgetDispose_());
var div = Blockly.WidgetDiv.DIV;
// Create the input.
- var htmlInput = goog.dom.createDom('input', 'blocklyHtmlInput');
+ var htmlInput =
+ goog.dom.createDom(goog.dom.TagName.INPUT, 'blocklyHtmlInput');
htmlInput.setAttribute('spellcheck', this.spellcheck_);
var fontSize =
(Blockly.FieldTextInput.FONTSIZE * this.workspace_.scale) + 'pt';
diff --git a/core/toolbox.js b/core/toolbox.js
index bfb131c50..5a5096c7a 100644
--- a/core/toolbox.js
+++ b/core/toolbox.js
@@ -28,6 +28,7 @@ goog.provide('Blockly.Toolbox');
goog.require('Blockly.Flyout');
goog.require('goog.dom');
+goog.require('goog.dom.TagName');
goog.require('goog.events');
goog.require('goog.events.BrowserFeature');
goog.require('goog.html.SafeHtml');
@@ -147,7 +148,8 @@ Blockly.Toolbox.prototype.init = function() {
var svg = this.workspace_.getParentSvg();
// Create an HTML container for the Toolbox menu.
- this.HtmlDiv = goog.dom.createDom('div', 'blocklyToolboxDiv');
+ this.HtmlDiv =
+ goog.dom.createDom(goog.dom.TagName.DIV, 'blocklyToolboxDiv');
this.HtmlDiv.setAttribute('dir', workspace.RTL ? 'RTL' : 'LTR');
svg.parentNode.insertBefore(this.HtmlDiv, svg);
@@ -186,8 +188,11 @@ Blockly.Toolbox.prototype.init = function() {
tree.setShowLines(false);
tree.setShowExpandIcons(false);
tree.setSelectedItem(null);
- this.populate_(workspace.options.languageTree);
+ var openNode = this.populate_(workspace.options.languageTree);
tree.render(this.HtmlDiv);
+ if (openNode) {
+ tree.setSelectedItem(openNode);
+ }
this.addColour_();
this.position();
};
@@ -255,14 +260,16 @@ Blockly.Toolbox.prototype.position = function() {
/**
* Fill the toolbox with categories and blocks.
- * @param {Node} newTree DOM tree of blocks, or null.
+ * @param {!Node} newTree DOM tree of blocks.
+ * @return {Node} Tree node to open at startup (or null).
* @private
*/
Blockly.Toolbox.prototype.populate_ = function(newTree) {
this.tree_.removeChildren(); // Delete any existing content.
this.tree_.blocks = [];
this.hasColours_ = false;
- this.syncTrees_(newTree, this.tree_, this.workspace_.options.pathToMedia);
+ var openNode =
+ this.syncTrees_(newTree, this.tree_, this.workspace_.options.pathToMedia);
if (this.tree_.blocks.length) {
throw 'Toolbox cannot have both blocks and categories in the root level.';
@@ -270,16 +277,19 @@ Blockly.Toolbox.prototype.populate_ = function(newTree) {
// Fire a resize event since the toolbox may have changed width and height.
this.workspace_.resizeContents();
+ return openNode;
};
/**
* Sync trees of the toolbox.
- * @param {Node} treeIn DOM tree of blocks, or null.
- * @param {Blockly.Toolbox.TreeControl} treeOut
+ * @param {!Node} treeIn DOM tree of blocks.
+ * @param {!Blockly.Toolbox.TreeControl} treeOut
* @param {string} pathToMedia
+ * @return {Node} Tree node to open at startup (or null).
* @private
*/
Blockly.Toolbox.prototype.syncTrees_ = function(treeIn, treeOut, pathToMedia) {
+ var openNode = null;
var lastElement = null;
for (var i = 0, childIn; childIn = treeIn.childNodes[i]; i++) {
if (!childIn.tagName) {
@@ -296,7 +306,10 @@ Blockly.Toolbox.prototype.syncTrees_ = function(treeIn, treeOut, pathToMedia) {
// Variables and procedures are special dynamic categories.
childOut.blocks = custom;
} else {
- this.syncTrees_(childIn, childOut, pathToMedia);
+ var newOpenNode = this.syncTrees_(childIn, childOut, pathToMedia);
+ if (newOpenNode) {
+ openNode = newOpenNode;
+ }
}
var colour = childIn.getAttribute('colour');
if (goog.isString(colour)) {
@@ -311,7 +324,9 @@ Blockly.Toolbox.prototype.syncTrees_ = function(treeIn, treeOut, pathToMedia) {
}
if (childIn.getAttribute('expanded') == 'true') {
if (childOut.blocks.length) {
- this.tree_.setSelectedItem(childOut);
+ // This is a category that directly contians blocks.
+ // After the tree is rendered, open this category and show flyout.
+ openNode = childOut;
}
childOut.setExpanded(true);
} else {
@@ -346,6 +361,7 @@ Blockly.Toolbox.prototype.syncTrees_ = function(treeIn, treeOut, pathToMedia) {
break;
}
}
+ return openNode;
};
/**
diff --git a/core/tooltip.js b/core/tooltip.js
index 3aa828812..2ff612b7b 100644
--- a/core/tooltip.js
+++ b/core/tooltip.js
@@ -32,6 +32,7 @@
goog.provide('Blockly.Tooltip');
goog.require('goog.dom');
+goog.require('goog.dom.TagName');
/**
@@ -120,7 +121,8 @@ Blockly.Tooltip.createDom = function() {
return; // Already created.
}
// Create an HTML container for popup overlays (e.g. editor widgets).
- Blockly.Tooltip.DIV = goog.dom.createDom('div', 'blocklyTooltipDiv');
+ Blockly.Tooltip.DIV =
+ goog.dom.createDom(goog.dom.TagName.DIV, 'blocklyTooltipDiv');
document.body.appendChild(Blockly.Tooltip.DIV);
};
diff --git a/core/widgetdiv.js b/core/widgetdiv.js
index 837364d99..a811339b3 100644
--- a/core/widgetdiv.js
+++ b/core/widgetdiv.js
@@ -30,6 +30,7 @@ goog.provide('Blockly.WidgetDiv');
goog.require('Blockly.Css');
goog.require('goog.dom');
+goog.require('goog.dom.TagName');
goog.require('goog.style');
@@ -61,7 +62,8 @@ Blockly.WidgetDiv.createDom = function() {
return; // Already created.
}
// Create an HTML container for popup overlays (e.g. editor widgets).
- Blockly.WidgetDiv.DIV = goog.dom.createDom('div', 'blocklyWidgetDiv');
+ Blockly.WidgetDiv.DIV =
+ goog.dom.createDom(goog.dom.TagName.DIV, 'blocklyWidgetDiv');
document.body.appendChild(Blockly.WidgetDiv.DIV);
};
diff --git a/demos/blocklyfactory/app_controller.js b/demos/blocklyfactory/app_controller.js
index d9a092132..58477cb41 100644
--- a/demos/blocklyfactory/app_controller.js
+++ b/demos/blocklyfactory/app_controller.js
@@ -304,6 +304,9 @@ AppController.prototype.onTab = function() {
FactoryUtils.hide('workspaceFactoryContent');
} else if (this.selectedTab == 'WORKSPACE_FACTORY') {
+ // Update block library category.
+ var categoryXml = this.exporter.getBlockLibCategory();
+ this.workspaceFactoryController.setBlockLibCategory(categoryXml);
// Hide container of exporter.
FactoryUtils.hide('blockLibraryExporter');
// Show workspace factory container.
diff --git a/demos/blocklyfactory/index.html b/demos/blocklyfactory/index.html
index c7792cd37..9f5841292 100644
--- a/demos/blocklyfactory/index.html
+++ b/demos/blocklyfactory/index.html
@@ -15,7 +15,7 @@
-
+
@@ -487,13 +487,6 @@
-
-
-
- 1
-
-
-
@@ -715,7 +708,8 @@
+