Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion blocks/argument_local.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,18 @@ const {Msg} = goog.require('Blockly.Msg');
if (this.isInFlyout) {
return;
}
// Remove option disable block
options.pop();

// Disable rename variable with context menu for procedures block.
const block = this;
const parentBlock = block.getParent();
if (parentBlock &&
(parentBlock.type === 'procedures_with_argument_defnoreturn' ||
parentBlock.type === 'procedures_with_argument_defreturn')) {
return;
}

const option = {
enabled: true,
text: Msg['RENAME_ARGUMENT'],
Expand All @@ -99,11 +110,13 @@ const {Msg} = goog.require('Blockly.Msg');
* @return {!function()} A function that renames the argument.
*/
const renameOptionCallbackFactory = function(block) {
const argumentValue = block.getFieldValue('VALUE');
const argumentValue = block.getFieldValue('VALUE');
return function() {
const callback = (newName) => {
block.setFieldValue(newName, 'VALUE');
block.setFieldText(newName, 'VALUE');
const field = block.getField('VALUE');
field.forceRerender();
};
const msg = Msg['RENAME_ARGUMENT_TITLE'].replace('%1', argumentValue);
dialog.prompt(msg, 'default', callback);
Expand Down