I want to change the field text of the block , but the width of the block doesn't resize according to the text width after connecting to the parent block.
Blockly.Blocks.lists_create_with={
init:function(){
this.setHelpUrl(Blockly.Msg.LISTS_CREATE_WITH_HELPURL);
this.setStyle("list_blocks");
this.itemCount_=3;
this.updateShape_();
this.setOutput(!0,"Array");
this.setMutator(new Blockly.Mutator(["lists_create_with_item"]));
this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_TOOLTIP)
}
//etc...
,onchange: function(event) {
if (!this.workspace || this.workspace.isFlyout) {
return;
}
if (!event.recordUndo) {
return;
}
if (this.mutator.block_.parentBlock_) {
if (this.mutator.block_.parentBlock_.type=="procedures_callnoreturn"||this.mutator.block_.parentBlock_.type=="procedures_callreturn") {
this.getField("TITLE").fieldGroup_.childNodes[0].innerHTML=Blockly.Msg["LISTS_CREATE_WITH_INPUT_WITH_PROCEDURE_VALUE"];
this.getField("TITLE").isDirty_=true;
return;
}
}
if (this.itemCount_)
this.getField("TITLE").fieldGroup_.childNodes[0].innerHTML=Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH;
else
this.getField("TITLE").fieldGroup_.childNodes[0].innerHTML=Blockly.Msg.LISTS_CREATE_EMPTY_TITLE;
this.getField("TITLE").isDirty_=true;
}
};