GeezerVison is showing github.com — fix: fix bug that caused the number/string input in the custom block … · scratchfoundation/scratch-blocks@c3ee958
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/fields/field_textinput_removable.js +20-17Lines changed: 20 additions & 17 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,26 +40,29 @@ import * as Blockly from "blockly/core"; |
40 | 40 | export class FieldTextInputRemovable extends Blockly.FieldTextInput { |
41 | 41 | /** |
42 | 42 | * Show the inline free-text editor on top of the text with the remove button. |
43 | | - * @private |
44 | 43 | */ |
45 | 44 | showEditor_() { |
46 | | - super.showEditor_(); |
| 45 | + // Wait for our parent block to render so we can examine its metrics to |
| 46 | + // calculate rounded corners on the editor as needed. |
| 47 | + Blockly.renderManagement.finishQueuedRenders().then(() => { |
| 48 | + super.showEditor_(); |
47 | 49 |
|
48 | | - const div = Blockly.WidgetDiv.getDiv(); |
49 | | - div.className += " removableTextInput"; |
50 | | - const removeButton = document.createElement("img"); |
51 | | - removeButton.className = "blocklyTextRemoveIcon"; |
52 | | - removeButton.setAttribute( |
53 | | - "src", |
54 | | - this.sourceBlock_.workspace.options.pathToMedia + "icons/remove.svg" |
55 | | - ); |
56 | | - this.removeButtonMouseWrapper_ = Blockly.browserEvents.bind( |
57 | | - removeButton, |
58 | | - "mousedown", |
59 | | - this, |
60 | | - this.removeCallback_ |
61 | | - ); |
62 | | - div.appendChild(removeButton); |
| 50 | + const div = Blockly.WidgetDiv.getDiv(); |
| 51 | + div.className += " removableTextInput"; |
| 52 | + const removeButton = document.createElement("img"); |
| 53 | + removeButton.className = "blocklyTextRemoveIcon"; |
| 54 | + removeButton.setAttribute( |
| 55 | + "src", |
| 56 | + this.sourceBlock_.workspace.options.pathToMedia + "icons/remove.svg" |
| 57 | + ); |
| 58 | + this.removeButtonMouseWrapper_ = Blockly.browserEvents.bind( |
| 59 | + removeButton, |
| 60 | + "mousedown", |
| 61 | + this, |
| 62 | + this.removeCallback_ |
| 63 | + ); |
| 64 | + div.appendChild(removeButton); |
| 65 | + }); |
63 | 66 | } |
64 | 67 |
|
65 | 68 | /** |
|