This commit is contained in:
Rachel Fenichel
2016-10-31 14:38:55 -07:00
parent 703bd96f7e
commit 4d02e9bee6
3 changed files with 7 additions and 5 deletions

View File

@@ -127,7 +127,7 @@ Blockly.flyoutButtonCallbacks_ = {};
/**
* Register a callback function associated with a given key, for clicks on
* buttons and labels in the flyout.
* For instance, a button specified by the xml
* For instance, a button specified by the XML
* <button text="create variable" callbackKey="CREATE_VARIABLE"></button>
* should be matched by a call to
* registerButtonCallback("CREATE_VARIABLE", yourCallbackFunction).

View File

@@ -700,9 +700,9 @@ Blockly.Flyout.prototype.show = function(xmlList) {
}
} else if (tagName == 'BUTTON') {
var label = xml.getAttribute('text');
var callback_key = xml.getAttribute('callbackKey');
var callbackKey = xml.getAttribute('callbackKey');
var curButton = new Blockly.FlyoutButton(this.workspace_,
this.targetWorkspace_, label, callback_key);
this.targetWorkspace_, label, callbackKey);
contents.push({type: 'button', button: curButton});
gaps.push(default_gap);
}

View File

@@ -36,9 +36,11 @@ goog.require('goog.math.Coordinate');
* button.
* @param {!Blockly.WorkspaceSvg} targetWorkspace The flyout's target workspace.
* @param {string} text The text to display on the button.
* @param {string} callbackKey The key to use when looking up the callback for a
* click on this button.
* @constructor
*/
Blockly.FlyoutButton = function(workspace, targetWorkspace, text, callback_key) {
Blockly.FlyoutButton = function(workspace, targetWorkspace, text, callbackKey) {
/**
* @type {!Blockly.WorkspaceSvg}
* @private
@@ -68,7 +70,7 @@ Blockly.FlyoutButton = function(workspace, targetWorkspace, text, callback_key)
* @type {function(!Blockly.FlyoutButton)}
* @private
*/
this.callback_ = Blockly.flyoutButtonCallbacks_[callback_key];
this.callback_ = Blockly.flyoutButtonCallbacks_[callbackKey];
};
/**