Skip to content

Commit

Permalink
fix: fix bug that caused the number/string input in the custom block …
Browse files Browse the repository at this point in the history
…editor to have square corners (#213)
  • Loading branch information
gonfunko authored Oct 14, 2024
1 parent 7ce9991 commit c3ee958
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions src/fields/field_textinput_removable.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,29 @@ import * as Blockly from "blockly/core";
export class FieldTextInputRemovable extends Blockly.FieldTextInput {
/**
* Show the inline free-text editor on top of the text with the remove button.
* @private
*/
showEditor_() {
super.showEditor_();
// Wait for our parent block to render so we can examine its metrics to
// calculate rounded corners on the editor as needed.
Blockly.renderManagement.finishQueuedRenders().then(() => {
super.showEditor_();

const div = Blockly.WidgetDiv.getDiv();
div.className += " removableTextInput";
const removeButton = document.createElement("img");
removeButton.className = "blocklyTextRemoveIcon";
removeButton.setAttribute(
"src",
this.sourceBlock_.workspace.options.pathToMedia + "icons/remove.svg"
);
this.removeButtonMouseWrapper_ = Blockly.browserEvents.bind(
removeButton,
"mousedown",
this,
this.removeCallback_
);
div.appendChild(removeButton);
const div = Blockly.WidgetDiv.getDiv();
div.className += " removableTextInput";
const removeButton = document.createElement("img");
removeButton.className = "blocklyTextRemoveIcon";
removeButton.setAttribute(
"src",
this.sourceBlock_.workspace.options.pathToMedia + "icons/remove.svg"
);
this.removeButtonMouseWrapper_ = Blockly.browserEvents.bind(
removeButton,
"mousedown",
this,
this.removeCallback_
);
div.appendChild(removeButton);
});
}

/**
Expand Down

0 comments on commit c3ee958

Please # to comment.