Commit e0166b63 authored by carlosperate's avatar carlosperate

Merge branch 'master' of https://github.com/google/blockly

parents 261e382c c5183726
......@@ -273,7 +273,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
if (change) {
this.updateParams_();
// Update the mutator's variables if the mutator is open.
if (this.mutator.isVisible_()) {
if (this.mutator.isVisible()) {
var blocks = this.mutator.workspace_.getAllBlocks();
for (var i = 0, block; block = blocks[i]; i++) {
if (block.type == 'procedures_mutatorarg' &&
......@@ -428,10 +428,9 @@ Blockly.Blocks['procedures_callnoreturn'] = {
init: function() {
this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL);
this.setColour(Blockly.Blocks.procedures.HUE);
this.appendDummyInput()
this.appendDummyInput('TOPROW')
.appendField(Blockly.Msg.PROCEDURES_CALLNORETURN_CALL)
.appendField('', 'NAME')
.appendField(Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS, 'WITH');
.appendField('', 'NAME');
this.setPreviousStatement(true);
this.setNextStatement(true);
// Tooltip is set in domToMutation.
......@@ -488,6 +487,12 @@ Blockly.Blocks['procedures_callnoreturn'] = {
this.quarkArguments_ = null;
return;
}
if (goog.array.equals(this.arguments_, paramNames)) {
// No change.
this.quarkArguments_ = paramIds;
return;
}
this.setCollapsed(false);
if (paramIds.length != paramNames.length) {
throw 'Error: paramNames and paramIds must be the same length.';
}
......@@ -536,14 +541,21 @@ Blockly.Blocks['procedures_callnoreturn'] = {
}
}
}
if (savedRendered) {
input.init();
}
input.init();
}
// Add 'with:' if there are parameters.
var withField = this.getField_('WITH');
if (withField) {
withField.setVisible(!!this.arguments_.length);
var input = this.getInput('TOPROW');
if (input) {
if (this.arguments_.length) {
if (!this.getField_('WITH')) {
input.appendField(Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS, 'WITH');
input.init();
}
} else {
if (this.getField_('WITH')) {
input.removeField('WITH');
}
}
}
// Restore rendering and show the changes.
this.rendered = savedRendered;
......@@ -578,7 +590,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
(this.outputConnection ? Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP :
Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace('%1', name));
var def = Blockly.Procedures.getDefinition(name, this.workspace);
if (def && def.mutator.isVisible()) {
if (def && def.mutator && def.mutator.isVisible()) {
// Initialize caller with the mutator's IDs.
this.setProcedureParameters(def.arguments_, def.paramIds_);
} else {
......@@ -634,10 +646,9 @@ Blockly.Blocks['procedures_callreturn'] = {
init: function() {
this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL);
this.setColour(Blockly.Blocks.procedures.HUE);
this.appendDummyInput()
this.appendDummyInput('TOPROW')
.appendField(Blockly.Msg.PROCEDURES_CALLRETURN_CALL)
.appendField('', 'NAME')
.appendField(Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS, 'WITH');
.appendField('', 'NAME');
this.setOutput(true);
// Tooltip is set in domToMutation.
this.arguments_ = [];
......
This diff is collapsed.
......@@ -551,7 +551,10 @@ Blockly.removeAllRanges = function() {
* @private
*/
Blockly.isTargetInput_ = function(e) {
return e.target.type == 'textarea' || e.target.type == 'text';
return e.target.type == 'textarea' || e.target.type == 'text'
|| e.target.type == 'number' || e.target.type == 'email'
|| e.target.type == 'password' || e.target.type == 'search'
|| e.target.type == 'tel' || e.target.type == 'url';
};
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment