From 335cc2f1a7610e31f38e7917c5749d0f18b7cced Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Wed, 31 Jan 2024 23:17:46 +0000 Subject: [PATCH 1/5] Fix some broken functions --- core/field_textdropdown.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/field_textdropdown.js b/core/field_textdropdown.js index 4e192a33f6..2736f5c302 100644 --- a/core/field_textdropdown.js +++ b/core/field_textdropdown.js @@ -140,7 +140,7 @@ Blockly.FieldTextDropdown.prototype.showEditor_ = function() { * (human-readable text, language-neutral name). * @private */ -Blockly.FieldTextDropdown.prototype.getOptions_ = Blockly.FieldDropdown.prototype.getOptions_; +Blockly.FieldTextDropdown.prototype.getOptions = Blockly.FieldDropdown.prototype.getOptions; /** * Position a drop-down arrow at the appropriate location at render-time. @@ -156,6 +156,13 @@ 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. */ From 71ea9178c186801e771b07ada8902ffbb43384b1 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Thu, 1 Feb 2024 01:11:34 +0000 Subject: [PATCH 2/5] Add another missing function --- core/field_textdropdown.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/field_textdropdown.js b/core/field_textdropdown.js index 2736f5c302..2717831b81 100644 --- a/core/field_textdropdown.js +++ b/core/field_textdropdown.js @@ -133,6 +133,12 @@ Blockly.FieldTextDropdown.prototype.showEditor_ = function() { } }; +/** + * @return {boolean} True if the option list is generated by a function. + * Otherwise false. + */ +Blockly.FieldTextDropdown.prototype.isOptionListDynamic = Blockly.FieldDropdown.prototype.isOptionListDynamic; + /** * Return a list of the options for this dropdown. * See: Blockly.FieldDropDown.prototype.getOptions_. From 73dfc2d326f34c53c4898829881ad15531b3ff62 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Thu, 1 Feb 2024 01:25:53 +0000 Subject: [PATCH 3/5] Actually, these all need to be here --- core/field_textdropdown.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/core/field_textdropdown.js b/core/field_textdropdown.js index 2717831b81..c8f9b2b1f8 100644 --- a/core/field_textdropdown.js +++ b/core/field_textdropdown.js @@ -72,6 +72,44 @@ Blockly.FieldTextDropdown.fromJson = function(element) { return field; }; +/** + * Horizontal distance that a checkmark overhangs the dropdown. + */ +Blockly.FieldTextDropdown.CHECKMARK_OVERHANG = Blockly.FieldDropdown.CHECKMARK_OVERHANG; + +/** + * Mouse cursor style when over the hotspot that initiates the editor. + */ +Blockly.FieldTextDropdown.prototype.CURSOR = Blockly.FieldDropdown.prototype.CURSOR; + +/** + * Closure menu item currently selected. + * @type {?goog.ui.MenuItem} + */ +Blockly.FieldTextDropdown.prototype.selectedItem = Blockly.FieldDropdown.prototype.selectedItem; + +/** + * Language-neutral currently selected string or image object. + * @type {string|!Object} + * @private + */ +Blockly.FieldTextDropdown.prototype.value_ = Blockly.FieldDropdown.prototype.value_; + +/** + * SVG image element if currently selected option is an image, or null. + * @type {SVGElement} + * @private + */ +Blockly.FieldTextDropdown.prototype.imageElement_ = Blockly.FieldDropdown.prototype.imageElement_; + +/** + * Object with src, height, width, and alt attributes if currently selected + * option is an image, or null. + * @type {Object} + * @private + */ +Blockly.FieldTextDropdown.prototype.imageJson_ = Blockly.FieldDropdown.prototype.imageJson_; + /** * Install this text drop-down field on a block. */ From 7568e9bdf671458d23b1bd2a2ff4bd724a15080a Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Thu, 1 Feb 2024 01:53:12 +0000 Subject: [PATCH 4/5] Done, I think --- core/field_textdropdown.js | 71 +++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 24 deletions(-) diff --git a/core/field_textdropdown.js b/core/field_textdropdown.js index c8f9b2b1f8..cc7c2b00bf 100644 --- a/core/field_textdropdown.js +++ b/core/field_textdropdown.js @@ -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. */ @@ -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. @@ -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. @@ -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); From 0788ba25a886e6697e802cd687a4160445e92952 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Thu, 1 Feb 2024 03:19:47 +0000 Subject: [PATCH 5/5] Update field_textdropdown.js --- core/field_textdropdown.js | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/core/field_textdropdown.js b/core/field_textdropdown.js index cc7c2b00bf..e2c7a094cd 100644 --- a/core/field_textdropdown.js +++ b/core/field_textdropdown.js @@ -80,7 +80,7 @@ Blockly.FieldTextDropdown.CHECKMARK_OVERHANG = Blockly.FieldDropdown.CHECKMARK_O /** * Mouse cursor style when over the hotspot that initiates the editor. */ -Blockly.FieldTextDropdown.prototype.CURSOR = Blockly.FieldDropdown.prototype.CURSOR; +Blockly.FieldTextDropdown.prototype.CURSOR = Blockly.FieldTextInput.prototype.CURSOR; /** * Closure menu item currently selected. @@ -95,21 +95,6 @@ Blockly.FieldTextDropdown.prototype.selectedItem = Blockly.FieldDropdown.prototy */ Blockly.FieldTextDropdown.prototype.value_ = Blockly.FieldDropdown.prototype.value_; -/** - * SVG image element if currently selected option is an image, or null. - * @type {SVGElement} - * @private - */ -Blockly.FieldTextDropdown.prototype.imageElement_ = Blockly.FieldDropdown.prototype.imageElement_; - -/** - * Object with src, height, width, and alt attributes if currently selected - * option is an image, or null. - * @type {Object} - * @private - */ -Blockly.FieldTextDropdown.prototype.imageJson_ = Blockly.FieldDropdown.prototype.imageJson_; - /** * Install this text drop-down field on a block. */ @@ -171,11 +156,6 @@ Blockly.FieldTextDropdown.prototype.onHide = Blockly.FieldDropdown.prototype.onH */ 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. * See: Blockly.FieldDropDown.prototype.getOptions_. @@ -197,12 +177,6 @@ Blockly.FieldTextDropdown.prototype.getValue = Blockly.FieldDropdown.prototype.g */ 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.