Skip to content

Commit

Permalink
Done, I think
Browse files Browse the repository at this point in the history
  • Loading branch information
LilyMakesThings authored Feb 1, 2024
1 parent 73dfc2d commit 7568e9b
Showing 1 changed file with 47 additions and 24 deletions.
71 changes: 47 additions & 24 deletions core/field_textdropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,6 @@ Blockly.FieldTextDropdown.prototype.init = function() {
this.disableColourChange_ = true;
};

/**
* Close the input widget if this input is being deleted.
*/
Blockly.FieldTextDropdown.prototype.dispose = function() {
if (this.mouseUpWrapper_) {
Blockly.unbindEvent_(this.mouseUpWrapper_);
this.mouseUpWrapper_ = null;
Blockly.Touch.clearTouchIdentifier();
}
Blockly.FieldTextDropdown.superClass_.dispose.call(this);
};

/**
* If the drop-down isn't open, show the text editor.
*/
Expand All @@ -172,10 +160,21 @@ Blockly.FieldTextDropdown.prototype.showEditor_ = function() {
};

/**
* @return {boolean} True if the option list is generated by a function.
* Otherwise false.
* Callback when the drop-down menu is hidden.
*/
Blockly.FieldTextDropdown.prototype.isOptionListDynamic = Blockly.FieldDropdown.prototype.isOptionListDynamic;
Blockly.FieldTextDropdown.prototype.onHide = Blockly.FieldDropdown.prototype.onHide;

/**
* Handle the selection of an item in the dropdown menu.
* @param {!goog.ui.Menu} menu The Menu component clicked.
* @param {!goog.ui.MenuItem} menuItem The MenuItem selected within menu.
*/
Blockly.FieldTextDropdown.prototype.onItemSelected = Blockly.FieldDropdown.prototype.onItemSelected;

/**
* @private
*/
Blockly.FieldTextDropdown.prototype.trimOptions_ = Blockly.FieldDropdown.prototype.trimOptions_;

/**
* Return a list of the options for this dropdown.
Expand All @@ -186,6 +185,30 @@ Blockly.FieldTextDropdown.prototype.isOptionListDynamic = Blockly.FieldDropdown.
*/
Blockly.FieldTextDropdown.prototype.getOptions = Blockly.FieldDropdown.prototype.getOptions;

/**
* Get the language-neutral value from this dropdown menu.
* @return {string} Current text.
*/
Blockly.FieldTextDropdown.prototype.getValue = Blockly.FieldDropdown.prototype.getValue;

/**
* Set the language-neutral value for this dropdown menu.
* @param {string} newValue New value to set.
*/
Blockly.FieldTextDropdown.prototype.setValue = Blockly.FieldDropdown.prototype.setValue;

/**
* Sets the text in this field. Trigger a rerender of the source block.
* @param {?string} text New text.
*/
Blockly.FieldTextDropdown.prototype.setText = Blockly.FieldDropdown.prototype.setText;

/**
* @return {boolean} True if the option list is generated by a function.
* Otherwise false.
*/
Blockly.FieldTextDropdown.prototype.isOptionListDynamic = Blockly.FieldDropdown.prototype.isOptionListDynamic;

/**
* Position a drop-down arrow at the appropriate location at render-time.
* See: Blockly.FieldDropDown.prototype.positionArrow.
Expand All @@ -201,15 +224,15 @@ Blockly.FieldTextDropdown.prototype.positionArrow = Blockly.FieldDropdown.protot
Blockly.FieldTextDropdown.prototype.showDropdown_ = Blockly.FieldDropdown.prototype.showEditor_;

/**
* Handle the selection of an item in the dropdown menu.
* @param {!goog.ui.Menu} menu The Menu component clicked.
* @param {!goog.ui.MenuItem} menuItem The MenuItem selected within menu.
*/
Blockly.FieldTextDropdown.prototype.onItemSelected = Blockly.FieldDropdown.prototype.onItemSelected;

/**
* Callback when the drop-down menu is hidden.
* Close the input widget if this input is being deleted.
*/
Blockly.FieldTextDropdown.prototype.onHide = Blockly.FieldDropdown.prototype.onHide;
Blockly.FieldTextDropdown.prototype.dispose = function() {
if (this.mouseUpWrapper_) {
Blockly.unbindEvent_(this.mouseUpWrapper_);
this.mouseUpWrapper_ = null;
Blockly.Touch.clearTouchIdentifier();
}
Blockly.FieldTextDropdown.superClass_.dispose.call(this);
};

Blockly.Field.register('field_textdropdown', Blockly.FieldTextDropdown);

0 comments on commit 7568e9b

Please sign in to comment.