Distinguish category labels from other labels

This commit is contained in:
Eric Rosenbaum 2017-09-13 15:19:06 -04:00
parent 68e7f5ee31
commit 3f9798e0f3
2 changed files with 11 additions and 2 deletions

View file

@ -73,6 +73,13 @@ Blockly.FlyoutButton = function(workspace, targetWorkspace, xml, isLabel) {
*/
this.isLabel_ = isLabel;
/**
* Whether this button is a label at the top of a category.
* @type {boolean}
* @private
*/
this.isCategoryLabel_ = xml.getAttribute('category-label') === 'true';
/**
* Function to call when this button is clicked.
* @type {function(!Blockly.FlyoutButton)}

View file

@ -192,8 +192,10 @@ Blockly.Toolbox.prototype.showAll = function() {
var category = this.categoryMenu_.categories_[i];
// create a label node to go at the top of the category
var labelString = '<xml><label text="' + category.name_ +
'" web-class="categoryLabel"></label></xml>';
var labelString = '<xml><label text="' + category.name_ + '"' +
' category-label="true"' +
' web-class="categoryLabel">' +
'</label></xml>';
var labelXML = Blockly.Xml.textToDom(labelString);
allContents.push(labelXML.firstChild);