diff --git a/accessible/field-segment.component.js b/accessible/field-segment.component.js index 0f3ee6c58..4f2852a4e 100644 --- a/accessible/field-segment.component.js +++ b/accessible/field-segment.component.js @@ -156,6 +156,11 @@ blocklyApp.FieldSegmentComponent = ng.core.Component({ }, // Confirm a selection for dropdown fields. selectOption: function() { + if (this.optionValue != Blockly.Msg.RENAME_VARIABLE && this.optionValue != + Blockly.Msg.DELETE_VARIABLE.replace('%1', this.mainField.getValue())) { + this.mainField.setValue(this.optionValue); + } + if (this.optionValue == Blockly.Msg.RENAME_VARIABLE) { this.variableModalService.showRenameModal_(this.mainField.getValue()); } @@ -172,11 +177,6 @@ blocklyApp.FieldSegmentComponent = ng.core.Component({ return; } - if (this.optionValue != Blockly.Msg.RENAME_VARIABLE && this.optionValue != - Blockly.Msg.DELETE_VARIABLE.replace('%1', this.mainField.getValue())) { - this.mainField.setValue(this.optionValue); - } - var optionText = undefined; for (var i = 0; i < this.dropdownOptions.length; i++) { if (this.dropdownOptions[i].value == optionValue) { diff --git a/accessible/variable-add-modal.component.js b/accessible/variable-add-modal.component.js index 2220ce9ea..e113b49fb 100644 --- a/accessible/variable-add-modal.component.js +++ b/accessible/variable-add-modal.component.js @@ -43,6 +43,8 @@ blocklyApp.VariableAddModalComponent = ng.core.Component({
+

Add a variable...

+

New Variable Name: 1) { this.preRemoveShowHook(oldName, count); this.modalIsShown = true; @@ -74,6 +74,9 @@ blocklyApp.VariableModalService = ng.core.Class({ blocklyApp.workspace.deleteVariableInternal_(oldName); } }, + getNumVariables: function(oldName) { + return blocklyApp.workspace.getVariableUses(oldName).length; + }, // Hide the variable modal. hideModal: function() { this.modalIsShown = false; diff --git a/accessible/variable-remove-modal.component.js b/accessible/variable-remove-modal.component.js index 585f1cd61..480485342 100644 --- a/accessible/variable-remove-modal.component.js +++ b/accessible/variable-remove-modal.component.js @@ -43,10 +43,12 @@ blocklyApp.VariableRemoveModalComponent = ng.core.Component({

+

+ Delete {{getNumVariables()}} uses of the "{{currentVariableName}}" + variable? +

+ -

Remove {{count}} instances of - "{{currentVariableName}}" variable? -