From 51f42ef5a327ff1161dd18f04f92bdddefd26690 Mon Sep 17 00:00:00 2001 From: Sean Lip Date: Mon, 5 Dec 2016 17:52:45 -0800 Subject: [PATCH] Remove some functions from utilsService and consolidate code in workspace-tree.component.js. --- accessible/tree.service.js | 2 +- accessible/utils.service.js | 21 +-------------------- accessible/workspace-tree.component.js | 12 +++++++++++- 3 files changed, 13 insertions(+), 22 deletions(-) diff --git a/accessible/tree.service.js b/accessible/tree.service.js index 5589c3983..c355ee108 100644 --- a/accessible/tree.service.js +++ b/accessible/tree.service.js @@ -362,7 +362,7 @@ blocklyApp.TreeService = ng.core.Class({ var blockRootSuffix = this.getBlockRootSuffix_(); var blockId = blockRootNode.id.substring( 0, blockRootNode.id.length - blockRootSuffix.length); - return this.utilsService.getBlockById(blockId); + return blocklyApp.workspace.getBlockById(blockId); }, onKeypress: function(e, tree) { // TODO(sll): Instead of this, have a common ActiveContextService which diff --git a/accessible/utils.service.js b/accessible/utils.service.js index e6311cc10..e6adbf5af 100644 --- a/accessible/utils.service.js +++ b/accessible/utils.service.js @@ -28,7 +28,7 @@ var blocklyApp = {}; blocklyApp.UtilsService = ng.core.Class({ - constructor: function() {}, + constructor: [function() {}], generateUniqueId: function() { return 'blockly-' + Blockly.utils.genUid(); }, @@ -42,22 +42,6 @@ blocklyApp.UtilsService = ng.core.Class({ generateAriaLabelledByAttr: function(mainLabel, secondLabel) { return mainLabel + (secondLabel ? ' ' + secondLabel : ''); }, - getInputTypeLabel: function(connection) { - // Returns the input type name, or 'any' if any official input type - // qualifies. - if (connection.check_) { - return connection.check_.join(', '); - } else { - return Blockly.Msg.ANY; - } - }, - getBlockTypeLabel: function(inputBlock) { - if (inputBlock.type == Blockly.NEXT_STATEMENT) { - return Blockly.Msg.BLOCK; - } else { - return Blockly.Msg.VALUE; - } - }, getBlockDescription: function(block) { // We use 'BLANK' instead of the default '?' so that the string is read // out. (By default, screen readers tend to ignore punctuation.) @@ -65,8 +49,5 @@ blocklyApp.UtilsService = ng.core.Class({ }, isWorkspaceEmpty: function() { return !blocklyApp.workspace.topBlocks_.length; - }, - getBlockById: function(blockId) { - return blocklyApp.workspace.getBlockById(blockId); } }); diff --git a/accessible/workspace-tree.component.js b/accessible/workspace-tree.component.js index 1963ceb73..9b4693fdb 100644 --- a/accessible/workspace-tree.component.js +++ b/accessible/workspace-tree.component.js @@ -53,7 +53,7 @@ blocklyApp.WorkspaceTreeComponent = ng.core.Component({ [attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['inputMenuLabel' + i], 'blockly-submenu-indicator')" [attr.aria-level]="level + 1">