but I want a text block is created as soon as the user dragged the item in container. (pic 2)
It seems on every compose method call every thing should be deleted and created again. anyway I couldn't fix it. Is there anything else I can check of read? Thanks in advance.
Blockly.Constants.Text.TEXT_JOIN_MUTATOR_MIXIN = {
/**
* Modify this block to have the correct number of inputs.
* @private
* @this {Blockly.Block}
*/
updateShape_: function() {
if (this.itemCount_ && this.getInput('EMPTY')) {
this.removeInput('EMPTY');
} else if (!this.itemCount_ && !this.getInput('EMPTY')) {
this.appendDummyInput('EMPTY')
.appendField(this.newQuote_(true))
.appendField(this.newQuote_(false));
}
// Add new inputs.
for (var i = 0; i < this.itemCount_; i++) {
if (!this.getInput('ADD' + i)) {
var input = this.appendValueInput('ADD' + i).setAlign(Blockly.ALIGN_RIGHT);
//__________ extra section start ___________
var parentConnection = input.connection;
if (!parentConnection.targetBlock()) {
var child = this.workspace.newBlock("text");
parentConnection.connect(child.outputConnection);
child.initSvg();
child.render();
}
//__________ extra section end ___________
if (i == 0) {
input.appendField(Blockly.Msg['TEXT_JOIN_TITLE_CREATEWITH']);
}
}
}
// Remove deleted inputs.
while (this.getInput('ADD' + i)) {
this.removeInput('ADD' + i);
i++;
}
}
};