From e05308462105e183b007d4a21c150c6be444deac Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Fri, 20 Sep 2019 13:35:13 -0700 Subject: [PATCH] Changed dropdown field to use new configuration. (#3061) --- core/field_dropdown.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/field_dropdown.js b/core/field_dropdown.js index 5e5f48e10..48e7a531e 100644 --- a/core/field_dropdown.js +++ b/core/field_dropdown.js @@ -51,11 +51,14 @@ goog.require('Blockly.utils.userAgent'); * changes to the field's value. Takes in a language-neutral dropdown * option & returns a validated language-neutral dropdown option, or null to * abort the change. + * @param {Object=} opt_config A map of options used to configure the field. + * See the [field creation documentation]{@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/dropdown#creation} + * for a list of properties this parameter supports. * @extends {Blockly.Field} * @constructor * @throws {TypeError} If `menuGenerator` options are incorrectly structured. */ -Blockly.FieldDropdown = function(menuGenerator, opt_validator) { +Blockly.FieldDropdown = function(menuGenerator, opt_validator, opt_config) { if (typeof menuGenerator != 'function') { Blockly.FieldDropdown.validateOptions_(menuGenerator); } @@ -87,8 +90,8 @@ Blockly.FieldDropdown = function(menuGenerator, opt_validator) { var firstTuple = this.getOptions(false)[0]; // Call parent's constructor. - Blockly.FieldDropdown.superClass_.constructor.call(this, firstTuple[1], - opt_validator); + Blockly.FieldDropdown.superClass_.constructor.call( + this, firstTuple[1], opt_validator, opt_config); /** * SVG image element if currently selected option is an image, or null. @@ -125,7 +128,7 @@ Blockly.FieldDropdown.ImageProperties; * @nocollapse */ Blockly.FieldDropdown.fromJson = function(options) { - return new Blockly.FieldDropdown(options['options']); + return new Blockly.FieldDropdown(options['options'], undefined, options); }; /**